Hi there!
Our goal is to block action ‘Move to Placement’ in a specific status of a Candidate.
To achieve that we want to utilize Page Interactions script with a Submission Workflow Modal context.
Settings of the Page Interaction:
Page: Record
Action Add Edit Presave
Script:
var candidateStatus = null;
// function to get the Candidate status using AppBridge
async function getStatusValue() {
const candidate = form.data.candidate.id;
var temp;
const url = "search/Candidate?query=id:" + candidate + '&fields=status';
await API.appBridge.httpGET(url).then(function (result) {
temp = result.data.data[0].status;
});
candidateStatus = temp;
console.log('1 candidate status',candidateStatus);
console.log('2 form valid',form.isFormValid);
}
// function to validate the status and create an error message
async function validateStatus(){
if (candidateStatus === 'New'){
form.isFormValid = false;
form.errorMessage = 'Candidate is in status New! Placement creation blocked.';
} else {
form.isFormValid = true;
}
console.log('4 candidate status',candidateStatus);
console.log('5 form valid',form.isFormValid);
}
// main part of the script
(async () => {
if (API.pageContext === 'MoveToPlacement'){
await getStatusValue();
await validateStatus();
console.log('3 API',API);
form.isFormValid function in Page Interactions is not working correctly
Moderators: StaffingSupport, pmularski, BullhornSupport
-
- User
- Posts: 1
- Joined: Tue Oct 11, 2022 1:37 pm