Getting the params value from the URL in the client script and perform the actions
Syntax:
function pageInit(scriptContext) {
window.onbeforeunload = null;
//Getting parameter value from URL
let urlParams = new URLSearchParams(window.location.search);
let employeeId= urlParams.get(’empId’);
let record = scriptContext.currentRecord;
record.setValue({
fieldId: ‘custpage_jj_employee_id’,
value: employeeId
});
}
Explanation:
- window.location-> Object return the string of the current URL
- URLSearchParams-> Built-in JS interface method work with the string of the URL
- let employeeId= urlParams.get(’empId’); -> Can get the employeeId value from parameter