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

Bugs - some system fields don't work and concatenate seems broken #956

Closed
paustint opened this issue Jan 28, 2023 · 7 comments · Fixed by #970
Closed

Bugs - some system fields don't work and concatenate seems broken #956

paustint opened this issue Jan 28, 2023 · 7 comments · Fixed by #970
Labels

Comments

@paustint
Copy link

This formula reports a syntax error (works in Salesforce)

"$Api.Session_ID" & $Api.Session_ID & "\n" &
"$Api.Partner_Server_URL_90" & $Api.Partner_Server_URL_90 & "\n" &
"$CustomMetadata.Billing_Scenario__mdt.Scenario_1.Name__c" & $CustomMetadata.Billing_Scenario__mdt.Scenario_1.Name__c & "\n" &
"$Label.X1LABEL" & $Label.X1LABEL & "\n" &
"$Organization.Id" & $Organization.Id & "\n" &
"$Permission.SBQQ__CPQStandardPerm" & IF($Permission.SBQQ__CPQStandardPerm, "TRUE", "FALSE") & "\n" &
"$Profile.Name" & $Profile.Name & "\n" &
"$Setup.blng__BillingPrefix__c.blng__BarPrefix__c" & $Setup.blng__BillingPrefix__c.blng__BarPrefix__c & "\n" &
"$System.OriginDateTime" & TEXT($System.OriginDateTime) & "\n" &
"$User.City" & $User.City & "\n" &
"$UserRole.Name" & $UserRole.Name

This formula works to extract fields but when using & to concatenate, this breaks if a value is null
Incorrect parameter type for function 'ADD()'. Expected Number, received Null

$Api.Partner_Server_URL_90 &
$Label.X1LABEL &
$Organization.Id &
$Profile.Name &
TEXT($System.OriginDateTime) &
$User.City &
$UserRole.Name

Here was the data I passed in

{
    "$Api.Partner_Server_URL_90": {
        "type": "literal",
        "dataType": "text",
        "value": "https://austin-steelbrick-dev-ed.my.salesforce.com/services/Soap/u/9.0/00D50000000O712",
        "options": {
            "length": 86
        }
    },
    "$Label.X1LABEL": {
        "type": "literal",
        "dataType": "text",
        "value": "Test Label",
        "options": {
            "length": 10
        }
    },
    "$Organization.Id": {
        "type": "literal",
        "dataType": "text",
        "value": "00D50000000O712EAC",
        "options": {
            "length": 18
        }
    },
    "$User.City": {
        "type": "literal",
        "dataType": "null",
        "value": null
    },
    "$Profile.Name": {
        "type": "literal",
        "dataType": "text",
        "value": "System Administrator",
        "options": {
            "length": 20
        }
    },
    "$UserRole.Name": {
        "type": "literal",
        "dataType": "null",
        "value": null
    },
    "$System.OriginDateTime": {
        "type": "literal",
        "dataType": "datetime",
        "value": "1900-02-01T07:00:00.000Z"
    }
}
@paustint paustint changed the title Bugs Bugs - some system fields don't work and concatenate seems broken Jan 28, 2023
@paustint
Copy link
Author

Did some more troubleshooting - Looks like concatenation does not work on null values - I guess I can set to empty string and it should fix it?

{
    "$User.City": {
        "type": "literal",
        "dataType": "null",
        "value": null
    },
    "$Profile.Name": {
        "type": "literal",
        "dataType": "text",
        "value": "System Administrator",
        "options": {
            "length": 20
        }
    }
}

@leifg
Copy link
Owner

leifg commented Feb 27, 2023

Thank you for reporting. Was pretty busy the last couple of weeks. Hopefully I can look at this

@github-actions
Copy link

github-actions bot commented Mar 1, 2023

🎉 This issue has been resolved in version 6.24.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@leifg
Copy link
Owner

leifg commented Mar 1, 2023

Can you try again with version 6.24.3 (or later)?

@paustint
Copy link
Author

paustint commented Mar 1, 2023

@leifg - Still getting the error, but I had previously worked around it by ensuring the value was an empty string.

Initially I was setting the data to this shape below, which produces the error:

{
    type: 'literal',
    dataType: 'null',
    value: null,
}

I have been using this and it has been working correctly:

{
  type: 'literal',
  dataType,
  value: value || '',
  options: {
    length: value?.length || 0,
  },
};

@leifg leifg reopened this Mar 1, 2023
@leifg
Copy link
Owner

leifg commented Mar 1, 2023

Mmh interesting. I currently don’t have a salesforce account to verify what the expected behavior is.

Can you try switching the order: Concatenate a string with null?

also can you try what happens if you concatenate two null values.

Also does it make a difference wether you use the & operator or the + operator?

@paustint
Copy link
Author

paustint commented Mar 1, 2023

@leifg - Just tested again and it looks like it is working. I did upgrade the version again (not sure if that matters), but maybe I tested incorrectly the first time.

Looks like both text and null data types work with concatenation when the value is null and do not throw an error.

I think we are good here - thanks for the fix!

@paustint paustint closed this as completed Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants