what trigger type should be used in a workflow for...
# ask-stanley-ai
s
what trigger type should be used in a workflow for set field value
c
AI generated answer (using internal Slack threads):
The trigger type to be used in a workflow for setting a field value can vary depending on the specific use case. 1. If you want to set a field value when a record is loaded, you can use the "Before Record Load" trigger. However, please note that you cannot directly set the field value in the BEFORE LOAD event for an existing record. Instead, you can use this trigger to enter a state that triggers a Workflow Action Script on entry. This script will then set the field value. Here is an example of such a script:
Copy code
javascript
function updateField(){
    var recType = nlapiGetRecordType();
    var recId = nlapiGetRecordId();

    var rec = nlapiLoadRecord(recType,recId);
    rec.setFieldValue('initialresponsetime','T'); //assuming that field is a checkbox. If it is not, replace 'T' with the value you are giving it.

    nlapiSubmitRecord(rec);
}
2. If you want to set a field value in a scheduled workflow, you should set the trigger to "On Entry". 3. If you want to set a field value upon clicking a button on a record, you can use the "Button" trigger. However, please note that setting a field value from a workflow will not trigger a User Event script. This is because User Event scripts cannot be executed by other User Event scripts or by workflows with a Context of User Event Script. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826454639
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821654081
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821267247
Please provide your feedback on this answer.