Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple formula returning incorrect Field API name #6

Open
phawthornffdc opened this issue Oct 26, 2023 · 2 comments
Open

Simple formula returning incorrect Field API name #6

phawthornffdc opened this issue Oct 26, 2023 · 2 comments

Comments

@phawthornffdc
Copy link

https://github.com/pgonzaleznetwork/forcemula/blob/867b26d0f2b4cf8d06c1610f5c2c216d0012fd89/src/index.ts#L63C1-L64C1

Simple formula

IF(Indicator__c, 0 - Total__c, Total__c)

Is producing an incorrect result. It is prefixing Total__c field with a 0, e.g. Account.0Total__c

Steps to reproduce:

import parse from 'forcemula';
const { json: { customFields} } = parse({
	parentObject: "Account",
	formula: "IF(Indicator__c, 0 - Total__c, Total__c)"
});

Current Behaviour:

customFields are returned as:

[ 'Account.Indicator__c', 'Account.0Total__c' ]

Expected Behaviour:

customFields should be:

[ 'Account.Indicator__c', 'Account.Total__c' ]

@pgonzaleznetwork
Copy link
Owner

Thank you @phawthornffdc ! Have you been able to identify where the issue is? I'm extremely busy these days so it'll be a few weeks before I can look at this. If you know where the issue is, that'll help.

@phawthornffdc
Copy link
Author

Hi @pgonzaleznetwork thanks for looking. I think the issue is on the line I referenced above, I "fixed" locally and it seems to work well but wasn't sure if there'd be any wider ramifications.

Fix was simply to check currentWord.length > 0 instead of currentWord.length > 1.

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants