I came across a discussion that we can keep a link(assume 2 links-Yes/No) in a correspondence fragment rule and on click of that link we can hit a service REST to push response to the respective case. Here on click of Yes link we need to pass Yes as the parameter and on click of No, we need to pass the parameter to the service REST so that the service rest can open the same case from where the email has been triggered and update the clipboard whether it is Yes/No.
Has anyone implemented similar scenario?
Corresponding fragment
- Edited
AnoopKrishna I have come across this type of implementation. but I dont think so we can achieve case opening in harness by Using REST. I consider you need that too!
we can access activity by URL after enabling Allow direct invocation from the client or a service from the security tab.
Example:
http://localhost:8000/prweb?pyActivity=OpenCaseFromLink&Action=openWorkByHandle&InsHandle=ACME-IMPL-WORK%20H-1049
Here OpenCaseFromLink is an activity with Action, InsHandle as params declared in the rule and passed through query string parameters of the URL.
You can create an activity similar to this which opens the work handle and shows in harness. You can have additional param for selection (yes or no) passed in the URL. You can generate and specify inappropriate links in the correspondence.
I hope it helps you !
Nice getting some idea. There is a syntax for embedding a publicURLLink in corr rule right? Do you have it have it? If you have please provide that.
So on clicking on that link, this url will be invoked and it invokes the activity which can do the further processing right with our business logic in service activity.
AnoopKrishna There is a syntax for embedding a publicURLLink in corr rule right? Do you have it have it? If you have please provide that
You mean publicURLLink DSS ? Here is the JSP code to include that.
<%= pega_rules_utilities.getDataSystemSetting("Pega-ProCom", "publicURLLink")%>
yaa this is what i needed. Then that area where pyActivity-.... to hit the url ad embed activity..where to embed that?
AnoopKrishna You have to add link this inside the correspondence buttons right?
yaaa. This is what i understood. correct me if i am wrong.
- I have to create a service REST with required parameters to pass in which service activity to update the corresponding work object.
- Put this url in DSS.
- In the correspondence rule I have to keep a link/button which contains this url. (have doubts in this part. How to contain a button with the service url or do we need to use corr fragment here)
- Then on the click of link, it invokes the service rest and all works in the background.
Pls give me some idea on 3rd point.
AnoopKrishna I have a question on your requirement, When a user clicks on your Yes/No button from the email, What you want to display? Just a success string or else you want to open the case associated in the Pega Portal?
Just need to display, Accepted. If no, Rejected.
Ok, then fine.
AnoopKrishna In the correspondence rule I have to keep a link/button which contains this url. (have doubts in this part. How to contain a button with the service url or do we need to use corr fragment here)
You can generate URL in a DT and set it to a property before calling correspondence. Use Pega reference tag to include that URL inside correspondence.
For the user it should display Approve, but it should be containing the URL. I mean on click on Approve it should hit this URL(service REST) which will do further processing. Will pega reference tag to include that url inside correspondence will work this way? User should be displayed with Approve/Reject button and on clicking on any button I have to trigger the service rest(url).
AnoopKrishna You can include the below code inside the correspondence. Change PROPERTY_ID with respective operator ID which contains link value.
You can add custom CSS styles for the a tag to look like buttons.
<a href= "<pega:reference mode="javascript" name="PROPERTY_ID"></pega:reference>">Approve</a>
<a href= "<pega:reference mode="javascript" name="PROPERTY_ID"></pega:reference>">Reject</a>
The above code renders as link.
Let me know if you have further queries.
Thanks you. This should be fine for me. Got a clear picture
I can go 2 different service REST urls, one for Approve and one Reject. But how to handle with 1 service rest url by passing parameter Approved on clicking Approve button and passing Rejected on clicking Rejected button.
You can create a REST SERVICE with GET method which accepts a query string parameter to get Approve/Reject.
Then you can specify like below in the URL
URL?param_name=accept
URL?param_name=reject
Hope it helps!
got it