Christopher M. Tomkinson

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • Ok so that turned out to be easier than I thought (caution, noob learning here), I just put my function which I tightened up considerably into a rule where the Requester peoplepicker is changed from initial value and it works. Now if only I could obtain the email address from active directory I’d be completely set to go. Worse case, I can populate that via a workflow.

    `function getRequester() {
    setFieldValue(“RequesterLANID”,spjs.utility.getFieldValue({“fin”:”Requester”,”delimiter”:”,”,”key”:”loginName”}).slice(14));
    setFieldValue(“RequesterName”,spjs.utility.getFieldValue({“fin”:”Requester”,”delimiter”:”,”,”key”:”displayName”}));
    }’

    Hi Alexander. In our case we can’t assume the current user is the Requester, as often these request are submitted on behalf of a manger one of their staff members. It also would affect the approval flow, since if A submits on behalf of B, B would need to approve it first.

    I am setting the Submitter using {userProfile:WorkEmail} and {userProfile:UserName}. And I’m able to get the Requester’s name and LAN ID via a button on the form with this custom JS:

    On the tab:
    <button type="button" onclick="getRequester()">Get Requester
    
    In Custom JS:
    function getRequester() {
        var RequesterLANID
        var RequesterName
        RequesterLANID = spjs.utility.getFieldValue({"fin":"Requester","delimiter":",","key":"loginName"}).slice(14);
        RequesterName = spjs.utility.getFieldValue({"fin":"Requester","delimiter":",","key":"displayName"});
        setFieldValue("RequesterLANID",RequesterLANID);
        setFieldValue("RequesterName",RequesterName);
    }

    Note that I’d like to get a third value, the email address I can’t find the key value for that, as WorkEmail doesn’t return anything.

    I’d also prefer to not make a user click a button to populate the Requester details. Once they select a name from the people picker it should populate them. But if I try to trigger that function using onclick:

    document.getElementById("Requester_1f4555cf-abb5-46d6-9c90-cf0e0063d350_$ClientPeoplePicker").onchange = function() {getRequester()};

    all it will do it populate the fields with the characters I typed into the people picker, not the actual values.

    Thanks!

Viewing 2 posts - 1 through 2 (of 2 total)