Any help with this will be appreciated, as always... the effect is the same in a few different places so this explanation is generic.
- New record created via API from our website (new printer registration record (registration custom module))
- The new record criteria kick starts Process Definition.
- The process definition depends upon a calculated field to decide which route to take at a later part of it.
- However, it seems that at the point of record creation that the calculated field is not yet actually populated.
- If I do an edit / save or recalculate values within the record itself then the calculated field populates perfectly.
What I am doing is:
- Calculating the days from shipping the printer to the date of purchase submitted in the registration web form on our support site.
Below is a screen shot of the fields in question.
note empty 'printer shipped from the factory on' date field. This the trouble maker here. Its simply a calculated formula: related($s_serialnumber_g_registration_1,"dateshipped")
But from api created records fails to run.
And after me clicking Edit > Save on the record:
The shipped date is populated and therefore my calculation of the days from shipping to Purchase is accurate - this is the field I later rely upon in the process.
Note - If I create a new registration record just from the create button in the module the fields calculate fine.
So I am wondering....
Q1 - is there a difference between API creation and creating inside sugar modules manually. (I am not the Dev, I am the Admin)
Is there something else which can be added via the api to get the calculated fields to populate?
Q2 - Is there a way to force something like a recalculate values from inside my process definition? Then carry on with the rest of it.
I tried:
- to populate some random unrequired for anything else field at the start of the Process Definition to see if that had an effect like recalc / edit&save - which it did not.
- adding a 'wait' event for 1 minute... but that may be snake oil. Therefore a 'get message event' will probably be waiting forever too...
Hope that makes sense!
Many thanks...
Luke.