How to change sys_created_on datetime field value using insert business rule

Milan13
Giga Expert

Hello,

I have an insert/update business rule running upon sc_request table which inserts data into time_card table.

What I need is,  once the sc_request REQ record is updated and the business rule reacts by inserting REQ record data into time_card, sys_created_on field in time_card table should not be filled with actual time stamp of the REQ record update time (approval datetime "timestamp") but should take the date of REQ - "Opened" field (opened_at) and insert it into time_card table sys_created_on field - please see attached screen shots.

Snippet of  Gliderecord code in my business rule which should have done this but is not working:

 gr.sys_created_on = current.opened_at;

But for example this snippet of code in my BR is working fine (REQ user reference field being copied to time_card user reference field)

gr.user = current.requested_for;

Many thanks for any advice,

Milan

 

9 REPLIES 9

AbhishekGardade
Giga Sage

Hello Milan,
Which business rule have you used? AFTER OR BEFORE  insert/update? 

Have you added gr. update(); as below?

gr.sys_created_on = current.opened_at;

gr. update();

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade

 

Thank you,
Abhishek Gardade

You can't specify the created on date time on insert but you can update it after creation 

Can you share your complete script?

Thank you,
Abhishek Gardade

Hello,

it's after insert BR - It would be perfect to modify the sys_created_on field within the insert operation, I checked for the ACL and it's there but inactive.

Thanks a lot anyway!

Milan

Important Note here : You can't specify the created on date time on insert but you can update it after creation 

So try to update sys_created_on after creating of it

Thanks,
Abhishek Gardade

Thank you,
Abhishek Gardade