How to update a date field in a record based on import set.

vitoriaoliveira
Tera Contributor

Hi guys, I need some guidance or a step-by-step guide on how to do this.
I have a table u_property_registration and I have a table related to it called u_service_order, in this u_service_order there is a field called “ u_date_realized ” and in u_property_registration there is a field called u_ultimate_visit.
Both tables are linked by a field called u_fc_tbg_nova, which indicates that the records in u_service_order are children of u_property_registration.

Now, what I need is: Every time a call is created/updated in this u_service_order table and the record name is equal to u_fc_tbg_nova (from u_property_registration), the u_ultimate_visit field is updated with the most recent date from u_date_realized if it is greater than the previous one.

I need this because the requester will be importing into the u_service_order table.

1 REPLY 1

Zach N
Tera Guru

Hello!

 

I'll start with some guidance, but can provide some step-by-step if needed. There are two primary directions you can take. For a simple but scripted solution you can use a Business Rule, and for a low or no code solution you can use Flow Designer. Also, just to be clear I'm making the following assumptions:

 

  • u_property_registration is the parent record table, and u_service_order is the child record table.
  • u_fc_tbg_nova is a column on the u_property_registration table.

 

For a Business Rule you will want to create a rule on your u_service_order table, and have it run on Insert and Update. If the change needs to be available immediately, create an After rule, otherwise use an Async rule (more on that here) If possible you should also add some condition so that this doesn't run for every update. For example, at minimum the the rule should only run if u_date_realized is NOT empty. Next, you will want to use GlideRecord to perform a query (addQuery()) on the u_property_registration table using the u_fc_tbg_nova column where the current record is in that field. From there you can compare the two date fields, and update the record (update()) on the u_property_registration table.

If you'd rather have a low or no code solution, you can instead use Flow Designer. For the Trigger, you want to choose Record > Created or Updated. For Run Trigger, change to For Each Unique Change, and add your condition (u_date_realized | is not empty). Next you'll want to add a Look Up Record action on the u_property_registration table, where u_fc_tbg_nova is the triggered record in our flow. Use an if statement to compare the two fields, and use an Update Record action if u_date_realized > u_ultimate_visit.

 

EDIT: Based on your title, if this is a one time change via an Import Set, you can use a Transform Script instead on you your Transform Map. Process would be pretty much the same as the Business Rule example above.


Hope that helps! Let me know if you have any questions!