Solved

can't populate text controle with web request result


hello Community, 

 

i am working on a form that i need to get the user details via API ( name , section , userID...)

after that , i'll have to passe the UserID in web request to get the managerUserID and populate the text field with that value in the same form i can't acheive that. 

 

thank you  

 

 

icon

Best answer by kchaluvadi 19 July 2021, 15:37

View original

5 replies

Userlevel 3
Badge +12

Hi,


Is there any specific reason you are using web services to get the name, section, userID? On the Nintex form, you can userProfileLookup("domainlogin","InternalPropertyName") run time functions.


You can also get the manageruserid value too. I am not sure what is the 'section' property? Is it custom AD attribute? 


 


 

hi Kchaluvadi, 


 


yes, it's a must, the client asked that the user information are auto-filled in the form, and he specified that it's an API call

Userlevel 3
Badge +12

Hi,


Share the screen shot of your form to see how you are calling web service/API, how the ouput is stored. Also share screen shot of issue you are having.

hi, I solve it using javascript. I stored the result of the web request in varMyRequest (//root, all the content ) after that I created a textbox for every textbox I wanted to populate, for example ( 2 textboxes for the name ) one of them is connected to the Sharepoint column to store the information ( hidden textbox ) and the other one to display the value ( read-only, I disabled this textbox, here was the big problem because we need to the textbox to be read-only if you disable it's read-only, but the value is not stored in Sharepoint)


 


JS : 


 


NWF$(document).ready(function()
{
NWF$('#'+varMyRequest).change(function()
{
var tst = NWF$('#' + varMyRequest).val();
NWF$('#' + txtField1).val(tst.substring(tst.lastIndexOf("<FULL_NAME>") + 11, tst.lastIndexOf("</FULL_NAME>")));
NWF$('#' + txtField1p).val(tst.substring(tst.lastIndexOf("<FULL_NAME>") + 11, tst.lastIndexOf("</FULL_NAME>")));
NWF$('#' + txtField3).val(tst.substring(tst.lastIndexOf("<EMP_WORK_SITE_DESC_V>")+22, tst.lastIndexOf("</EMP_WORK_SITE_DESC_V>")));
NWF$('#' + txtField3p).val(tst.substring(tst.lastIndexOf("<EMP_WORK_SITE_DESC_V>")+22, tst.lastIndexOf("</EMP_WORK_SITE_DESC_V>")));

NWF$('#' + txtField4).val(tst.substring(tst.lastIndexOf("<EMP_WORK_SEC_DESC_V>")+21, tst.lastIndexOf("</EMP_WORK_SEC_DESC_V>")));
NWF$('#' + txtField4p).val(tst.substring(tst.lastIndexOf("<EMP_WORK_SEC_DESC_V>")+21, tst.lastIndexOf("</EMP_WORK_SEC_DESC_V>")));

NWF$('#' + txtField5).val(tst.substring(tst.lastIndexOf("<EMPLOYEE_NUMBER>")+17, tst.lastIndexOf("</EMPLOYEE_NUMBER>")));
NWF$('#' + txtField5p).val(tst.substring(tst.lastIndexOf("<EMPLOYEE_NUMBER>")+17, tst.lastIndexOf("</EMPLOYEE_NUMBER>")));
}
);


});


 


 


 

Userlevel 3
Badge +12

You can use the "Calculated control" to show the value of a SharePoint list, and calculated controls cannot be edit by users.  


Otherwise, update your script to enable the read-only control, fill the value and then disable. Hope it helps.

Reply