You need to sign in to do that
Don't have an account?
Madhu Dk
when accesing Flow Loop variable getting this errot: Formula result is data type (Object), incompatible with expected data type (Text)
Hi All,
i am working on Service Appointment History
i am fetching the record based on service appointment Id, Field is equal to Status, order by created date desc using Get Records.
next calling the loop
for every itteration i am checking a condition
if(loopvariable.NewValue=='InProgress'){
}
when i run this check it gives error
Error element ttttt (FlowDecision).
Formula result is data type (Object), incompatible with expected data type (Text).
1. GetRecords
2. Loop
3. Decision
i am working on Service Appointment History
i am fetching the record based on service appointment Id, Field is equal to Status, order by created date desc using Get Records.
next calling the loop
for every itteration i am checking a condition
if(loopvariable.NewValue=='InProgress'){
}
when i run this check it gives error
Error element ttttt (FlowDecision).
Formula result is data type (Object), incompatible with expected data type (Text).
1. GetRecords
2. Loop
3. Decision
I have seen such errors in the past. The error is very self-explanatory that the data type of NewValue and OldValue is Object and we are trying to perform TEXT operations on it. So ideally we should convert it into TEXT before using it in the display area or comparing with other text in decision elements.
NewValue is of type "AnyType", this field can hold the new value of any salesforce field type.
If a fast lookup is done on the object and stored in SObject collection variable - each SObject variable is looped through the decision and the decision compares Sobject. AnyType equals TextVaribale - that's the reason this error is rightfully thrown since two different data types cannot be compared.
For this to work, the object has to be retrieved via RecordLookup and the newvalue has to be stored in a text variable
Anudeep
Can you pls let me know how to retrieve via RecordLookup.
Right now i am doing get record on service appointment history and storing the details in a variable.
Thank you
I don't remember exactly how it is done but guess you need to add a record lookup element, create a text variable and assign the values of fields in the returned record to variables in the flow
See below references
[1] Adding and Configuring a Record Lookup Element
[2] Create the Flow and Add Variables
Anudeep
Hi Anudeep,
I'm actually running into the same issue and Salesforce doesn't seem to allow you to assign these to a text variable. When using an Assignment component and try to assign the field on the record to a text variable, it gives you the same error "Formula result is data type (Object), incompatible with expected data type (Text)". I also attempted to create a simple text formula that is pulls in the field, but my text variable comes back as null.
Any help would greatly be appreciated!
Once the records are retrieved and stored in a collection I can loop through them but attempting to assign any of the newval/oldval fields to a new text variable fails with an error "No such column 'NewvalString' on entity".
Also, the fields NewValue and OldValue become available for selection in flow elements if referencing a retrieved record (i.e. current record in loop), but trying to use them in a decision element or assignment element just causes the Flow to fail without an error. When debugging it just shows the "thinking" spinner indefinitely.
Any help or direction would be greatly appreciated.
First create a Variable(type Text) and assign the oldValue, then create a formula(you choose the type you want) and convert it using the formula, here I want number so my formula is
Then you can assign it into the field you want, I cannot add image so that just it.
Is this actually working for you?