Tuesday, October 23, 2018

Return a created record's Internal ID in a Workflow


This article shows how to return the Internal ID of a created record, coming from the workflow. On this sample, a phone call record is created every time a new customer record is made.

1. Create a new workflow by navigating to  Customization > Workflow > Workflows > New
 
2. Define the workflow
    a. Name = Return ID of created record
    b. Record Type = Customer
    c. Sub Types = Customer
    d. Release Status = Testing
    e. Initiation =  Event Based
    f.  On Create = TRUE
    g. Trigger Type = Before Record Submit
    h. Click Save.
 
3. Create an Instance custom field. On the workflow definition page, clicking the New Field button on the Fields tab. 
    a. Label = New Phone Call
    b. Type = List/Record
    c. List/Record = Call
    d. Store Value = TRUE
    e. Click Save.

* Take note of the instance custom field's Internal ID. You can customize the name or let the workflow assign one for you.

4. To add a workflow state, click New State and set Name = Create Phone Call, then hit Save.

5. To create an action to the state, click on the Create Phone Call state and click New Action
    a. Select Create Record.
    b. Trigger On = Entry
    c. Record Type = Phone Call
    d. Store Results in = New Phone Call (Workflow)
    e. Title = Call Company A
    f. Click Save.

6. Create another state and set Name = Get phone call ID.

7. Create an action to retrieve the phone call's Internal ID.
* On this sample, the phone call's Internal ID was indicated on the Comments field.

    a. New Action = Set Field Value.
    b. Field = Comment
    c. Value = Formula: {custworkflow_new_call_2.id} // custworkflow_new_call_2 is the instance custom field's Internal ID.
    d. Click Save.
 
8. Create a new transction. Select the Create Phone Call state first. Click the New Transition button and then select the Get phone call ID state.

No comments:

Post a Comment