pbustin Outstanding Contributor.
Outstanding Contributor.
360 views

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

Jump to solution
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.
0 Likes
1 Solution

Accepted Solutions
pearsallc Super Contributor.
Super Contributor.

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

Jump to solution
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 '" &&& strUserID &&& "'";
ObjCon = Ext.CreateAppRecord( Ext.TableId( "TS_CONTACTS" ));
if ( ObjCon.ReadWithWhere (sqlCon) ) {
nContact = ObjCon.GetId();
}

Shell.Item().SetFieldValue("CONTACT", nContact);
Shell.Item().SetFieldValue("SUBMITTER", strUserID);

View solution in original post

0 Likes
12 Replies
PM Thompson Acclaimed Contributor.
Acclaimed Contributor.

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

Jump to solution
For your example 1, the Contact field should sync with the TS_CONTACTS record of the Submitter.
For example 1a, is the submitter using the "submit on behalf of" feature where they select Submitter and where the actual Submitter is in "Submitting Agent"? In this instance, the Contact field should also sync up with the selected Submitter.
I guess the field mapping in the Subtask transition won't allow you to map the"parent" SUBMITTER field from project A to the SUBMITTER field for project B?
0 Likes
pearsallc Super Contributor.
Super Contributor.

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

Jump to solution
I've used the submitter & contacts fields to map from parent to subtask with subtask type transition. I haven't had to use a script to update it.

however I have updated the contact via app script for other purposes. that seems to work fine. but you may not be able to change on the submit. (unsure as I have not tried on the submit) you may have to put the script on a hidden transition, and invoke the transition via an action to auto run the transition with the script once an item is submitted.
0 Likes
pbustin Outstanding Contributor.
Outstanding Contributor.

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

Jump to solution
Thank you Paul and Charity. I will try mapping. Also, I need to try granting 'submit on behalf of' that I've seen but am not familiar with (I need to find that in App Admin, right?); that sounds as though it would solve the whole thing.
0 Likes
pbustin Outstanding Contributor.
Outstanding Contributor.

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

Jump to solution
I already use appscript to copy the Submitter to Original Submitter (text field), and I've also tried copying to a user field, but I haven't succeeded in copying Original Submitter to Submitter in Project B--lack of expertise. Hopefully, I won't need to try again, if 'submit on behalf of' or mapping work.
0 Likes
Highlighted
pbustin Outstanding Contributor.
Outstanding Contributor.

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

Jump to solution
I see a problem with 'submit on behalf of', because these items are being submitted automatically with the subtask transition. I'll try mapping.
0 Likes
pbustin Outstanding Contributor.
Outstanding Contributor.

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

Jump to solution
There appears to be no field that I can map to Submitter in the subtask transition.
0 Likes
pbustin Outstanding Contributor.
Outstanding Contributor.

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

Jump to solution
User is my contact record, but it won't map to Submitter, and even if it did, I'm thinking the Submit transition would overwrite it. I'll try Support, also.
0 Likes
pearsallc Super Contributor.
Super Contributor.

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

Jump to solution
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 '" &&& strUserID &&& "'";
ObjCon = Ext.CreateAppRecord( Ext.TableId( "TS_CONTACTS" ));
if ( ObjCon.ReadWithWhere (sqlCon) ) {
nContact = ObjCon.GetId();
}

Shell.Item().SetFieldValue("CONTACT", nContact);
Shell.Item().SetFieldValue("SUBMITTER", strUserID);

View solution in original post

0 Likes
pbustin Outstanding Contributor.
Outstanding Contributor.

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

Jump to solution
Charity, thank you. Now trying the obvious mapping. In 99% of cases, this would suffice, but it may happen that a tech submits a ticket for a user, and then decides it belongs in project B; in that case, I'd have to use the script.
0 Likes
pbustin Outstanding Contributor.
Outstanding Contributor.

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

Jump to solution
I'm in SBM 11.1; Composer guide makes no mention of modscript.
0 Likes
pbustin Outstanding Contributor.
Outstanding Contributor.

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

Jump to solution
Thank you everyone; you all mentioned mapping and it worked. I'll keep the script in mind if a tech submits a ticket for a user, and then submits into Project B.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.