Monday, February 4, 2019

Dynamically Add the 'Resource' based on the "Project Owner" field set from the Project Record via SuiteScript

Scenario: The customer has a custom field 'Project Owner' applied to Project record (List > Relationships > Projects). All of their project records belong to an individual (Project Owner) and they would like the ability to populate the value set on the 'Project Owner' to the 'Resource' field under Schedule > Project Tasks > Project Task records and to the 'Name' field under 'Resources' > Resources_Details without having to edit it manually. 

This is possible via user event script where it will populate the desired value based on the Project Owner field upon save. Note that the current logic of the following sample script first checks if there's a line item already added, if yes then it will not continue the script. 

Note:   The function for adding the 'Assignee' from the associated Project Task is needed to be placed on afterRecordSubmit event to avoid getting 'Invalid Reference Key' error.

No comments:

Post a Comment