How might I copy a Contact table subrelationial field to the Submitter?

Some time ago, I tried and failed (twice) to create an appscript or javascript that would copy a Contact table subrelational field I called User Name (first last) to the Submitter field.

1) Submitter A submits Item A into Project A. The Submitter is captured by Contact Record subrelational field 'User Name' (first last).

1a) Other times, Submitter B submits Item A on behalf of User A. In this case, Submitter B selects User Name from its drop-down list.

2) User B submits Item B with a subtask transition) into Project B from Item A.

2a) Item A's Submitter is the appropriate owner of some states in Project B--not Item B's Submitter.

3) The goal is to change the submitter for Item B, therefore, to User Name, assuming it's always a match. Speaking of that, there must be a script way to obtain the correct Submitter name from the Contact record, so that I'm not scripting a mechanical copy.
Parents
  • Verified Answer

    Also attaching screenshot for Submitter mapping on a subtask transition.

    below is a script (modscript) that I use to update submitter / contact for a duplicate work Item request.

    These are 2 different options.

    I'm also attaching screenshot within composer of how to add the security for submit on behalf of another user.
    We have an admin user "Script User" in which we make run script transitions from the notification context to set / run transitions with scripts in them.



    // --------------------------------------------------------------------------------------------------------------------------------------
    // Setting Contact, Submitter from the Current User for use with the Copy Work item
    // Created by Charity Pearsall
    // --------------------------------------------------------------------------------------------------------------------------------------
    //Option Explicit
    global strUserID = Variant();
    global nContact = Variant();
    global sqlCon = Variant();
    global ObjCon = Variant();
    strUserID = Shell.User().GetId();

    sqlCon = "TS_USERID LIKE '"
Reply
  • Verified Answer

    Also attaching screenshot for Submitter mapping on a subtask transition.

    below is a script (modscript) that I use to update submitter / contact for a duplicate work Item request.

    These are 2 different options.

    I'm also attaching screenshot within composer of how to add the security for submit on behalf of another user.
    We have an admin user "Script User" in which we make run script transitions from the notification context to set / run transitions with scripts in them.



    // --------------------------------------------------------------------------------------------------------------------------------------
    // Setting Contact, Submitter from the Current User for use with the Copy Work item
    // Created by Charity Pearsall
    // --------------------------------------------------------------------------------------------------------------------------------------
    //Option Explicit
    global strUserID = Variant();
    global nContact = Variant();
    global sqlCon = Variant();
    global ObjCon = Variant();
    strUserID = Shell.User().GetId();

    sqlCon = "TS_USERID LIKE '"
Children
No Data