Create approve & reject ribbon buttons, once click on approve it should change the status field to approve.If clicked on reject it should change to Reject. Based on status field change trigger work flow to send a email to stating request is approved/Rejected.
Create approve & reject ribbon buttons, once click on approve it should change the status field to approve.If clicked on reject it should change to Reject. Based on status field change trigger work flow to send a email to stating request is approved/Rejected.
Ans. For doing this we should follow step wise
Step 1: Create an entity name it as ApprovedBy.
Step 2: Create a field name with status and data type as Option set
Step 3: Create a new solution
Next Inside solution add existing entity > Click on entity component > now click on Add existing entity > search Your entity > select that entity and click on ok > an entity assert pop up is visible
In entity Asserts right side corner we can see two check box
l Include entity meta data
l Add all asserts
Now uncheck the Add all asserts > select the include entity metadata check box > Click on finish button > then Missing required component pop up will be appear.
For Missing required component left side corner we can see to option
l Yes include Required components
l No don’t include required components
Yes include Required components by default it is enable, now disable it > next enable No don’t include required components > click on ok
Step 4: Write a code in JavaScript > Create a web resource then paste the Java Script when creating web resource.
var formContext = primaryControl;
console.log("Approve");
formContext.getAttribute("effizz_checkstatus").setValue(684200000);
}
function OnClickReject(primaryControl) {
var formContext = primaryControl;
console.log("Reject");
formContext.getAttribute("effizz_checkstatus").setValue(684200001);
}
.png)
Step 5: Open XRM tool and install ribbon work bench
For Ribbon work bench open Tool Library > search ribbon work bench > install ribbon work bench
Step 6: Open ribbon work bench > Select the solution .
Step 7: Add two Commands approve and reject
Step 8: In Commands add action > web resource and function in action > then add parameter as Primary Control for both approve and reject
Step 9: Add these commands in Buttons > Create buttons
Step 10 : Create Two Buttons Approve and Reject with valid inputs
Step 11 : Create a Work flow >go to advance settings > setting >Process Center area > Process sub area
Step 12: In work flow Add step as Condition , now in if condition take entity name , field name is equals to approve and now select if condition and add step as send mail in that from as user of organization , to created by user (user) for approve.

Step 14: Now Activate the workflow go to CRM open entity and check weather the workflow is triggering or not and mail is sending or not
Work flow Triggered
Work Flow Triggered on clicking Approve button and on record field change
Work Flow Triggered on clicking Approve button and on record field change
Difference between enable rule and display rule?
Display rule | Enable rule |
These are evaluated in server side | These are evaluated in client side |
Custom rule is not present in enable rule | Custom rule is present in enable rule |
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)















Comments
Post a Comment