Support Topics Documentation Slack YouTube Blog

Unable to conditionally save an object - Codeless

Hi,

Codeless newbie here. I am trying to set up a workflow but have run into an issue.

I have set the ‘transaction’ variable to the transaction object and am trying to update a property based on a condition. However, it isn’t working.

The transaction and customer objects are correctly defined since they are saved correctly in the database in the above steps.

Can anyone help with this.

Thanks.

Could you please clarify what exactly is not working? Saying “not working” doesn’t help in understanding.

Regards,
Mark

Sorry, I meant the property 'is_first_txn" is not being set to true for the first transaction of the customer.

I recommend adding logging to make the logic is executed as you expect. Logging can be added using the “print” block and then you can see it in the real-time logging window.

Thanks. I tried using the print and can identify that the Get Object Count block is returning ‘0’ each time. But I am not sure what is the issue with that block. I checked the where clause in the REST Console and it returns the objects correctly.

I have further narrowed down the issue to the objectId of the customer object. When I print the customer object, I can see the objectId, but when I try to print the objectId property of the customer object, then it prints undefined

@mark-piller any help with this?

Your “customer” variable contains an array of objects , not an object. Notice that it is printed with [ ] surrounding the value.

1 Like

Ah ok. I understand now. Let me fix that and try. Thanks

Works! Thanks for the help @mark-piller