Set New Case Default Values when create new case
"Page Container " : "SendNewCaseInfo" > "Receive event payload"
window.myPayload = payload;
window.solutionPrefix= this.solution.getPrefix();
var editable = myPayload.caseEditable;
alert(editable);
if(editable != null){
require(['icm/model/properties/controller/ControllerManager'],
function(ControllerManager) {
var collectionController = ControllerManager.bind(editable);
collectionController.beginChangeSet();
//Get Current User Name
var PortEmployeeName = ecm.model.desktop.userDisplayName;
//Set as default value for textbox PortEmployeeName
collectionController.getPropertyController(solutionPrefix + '_PortEmployeeName').set('value',PortEmployeeName);
collectionController.endChangeSet();
ControllerManager.unbind(editable);
});
}
Show Hide field based on another field value
var solution = this.solution;
var prefix = solution.getPrefix();
require([ "icm/model/properties/controller/ControllerManager"]
, function( ControllerManager)
{
workItem = payload.workItemEditable;
this.collectionController = ControllerManager.bind(workItem);
this.collectionController.getPropertyController(prefix+"_PROJECTMILESTONDATES").watch("value", function(value){
if (value === "1"){
collectionController.getPropertyController(prefix+"_REVIEWUSERS").set("hidden", true);
} else {
collectionController.getPropertyController(prefix+"_REVIEWUSERS").set("hidden", false);
}
});
});
Add button beside textbox
search for textbox that has placeholder = "project_name" and add button beside it
dojo.query("input[placeholder='project_name']").forEach(function(item)
{
item.offsetParent.offsetParent.insertAdjacentHTML('beforeend', "<input type=button value=? class=btn >");
});
Open Case Details after Add Case
Pages > Add Case > Add Script Adapter widget > make it hidden > edit wiring
"Page Container " : "SendNewCaseInfo" > "Receive event payload"
window.myPayload = payload;
window.solutionPrefix= this.solution.getPrefix();
var editable = myPayload.caseEditable;
alert(editable);
if(editable != null){
require(['icm/model/properties/controller/ControllerManager'],
function(ControllerManager) {
var collectionController = ControllerManager.bind(editable);
collectionController.beginChangeSet();
//Get Current User Name
var PortEmployeeName = ecm.model.desktop.userDisplayName;
//Set as default value for textbox PortEmployeeName
collectionController.getPropertyController(solutionPrefix + '_PortEmployeeName').set('value',PortEmployeeName);
collectionController.endChangeSet();
ControllerManager.unbind(editable);
});
}
Show Hide field based on another field value
var solution = this.solution;
var prefix = solution.getPrefix();
require([ "icm/model/properties/controller/ControllerManager"]
, function( ControllerManager)
{
workItem = payload.workItemEditable;
this.collectionController = ControllerManager.bind(workItem);
this.collectionController.getPropertyController(prefix+"_PROJECTMILESTONDATES").watch("value", function(value){
if (value === "1"){
collectionController.getPropertyController(prefix+"_REVIEWUSERS").set("hidden", true);
} else {
collectionController.getPropertyController(prefix+"_REVIEWUSERS").set("hidden", false);
}
});
});
Add button beside textbox
search for textbox that has placeholder = "project_name" and add button beside it
dojo.query("input[placeholder='project_name']").forEach(function(item)
{
item.offsetParent.offsetParent.insertAdjacentHTML('beforeend', "<input type=button value=? class=btn >");
});
Add Case Custom validation before save
Workitem data validation
based on which step response is selected
Hiding Attachment widget based on some property
//var coord = payload.coordination;
//var caseEdit = payload.caseEditable;
//var solution = this.solution;
//var prefix = solution.getPrefix();
if (payload.eventName === "icm.SendWorkItem" )
{
var coordination = payload.coordination;
var workEdit = payload.workItemEditable;
if(workEdit.icmWorkItem.stepName === "Request for PreSubmission Meeting")
{
require(["icm/model/properties/controller/ControllerManager", "icm/base/Constants","ecm/model/Repository"],function(ControllerManager, Constants,repository)
{
coordination.participate(Constants.CoordTopic.AFTERLOADWIDGET, function(context, complete, abort)
{
var collectionController = ControllerManager.bind(workEdit);
var Controller = collectionController.getPropertyController("CPA_VarHideAttachment"); // CPA_VarHideAttachment Case property
var HideAttachment = Controller.get("value");
if(HideAttachment == "Yes")
{
dojo.query("span").forEach(function(item)
{
if(item.innerHTML==="Attachments")
{
var prnt = item.parentNode.parentNode.parentNode.parentNode.parentNode;
prnt.style.display = "none";
}
});
}
complete();
});
/* Use the AFTERLOADWIDGET coordination topic handler to release the controller binding for the editable. */
/* Since the prop controller can be shared, doing this in the AFTERLOADWIDGET ensures no other widget overrides your changes. */
coordination.participate(Constants.CoordTopic.AFTERLOADWIDGET, function(context, complete, abort) {
/* Release the controller binding for the editable. */
ControllerManager.unbind(workEdit);
/* Call the coordination completion method. */
complete();
});
});
}
}
- // Add a Script Adapter to your Add Case page and hide it
- // Wire the incoming event for the Script Adapter from the Page Container's Send New Case Information event
Workitem data validation
based on which step response is selected
- Add a Script Adaptor widget to the hidden widgets area on a work details page
- Wire an inbound event from the Page Container's Send Work Item to the Script Adaptor's Receive Event.
- The additional data validation logic will be triggered when the appropriate response button is clicked.
Hiding Attachment widget based on some property
//var coord = payload.coordination;
//var caseEdit = payload.caseEditable;
//var solution = this.solution;
//var prefix = solution.getPrefix();
if (payload.eventName === "icm.SendWorkItem" )
{
var coordination = payload.coordination;
var workEdit = payload.workItemEditable;
if(workEdit.icmWorkItem.stepName === "Request for PreSubmission Meeting")
{
require(["icm/model/properties/controller/ControllerManager", "icm/base/Constants","ecm/model/Repository"],function(ControllerManager, Constants,repository)
{
coordination.participate(Constants.CoordTopic.AFTERLOADWIDGET, function(context, complete, abort)
{
var collectionController = ControllerManager.bind(workEdit);
var Controller = collectionController.getPropertyController("CPA_VarHideAttachment"); // CPA_VarHideAttachment Case property
var HideAttachment = Controller.get("value");
if(HideAttachment == "Yes")
{
dojo.query("span").forEach(function(item)
{
if(item.innerHTML==="Attachments")
{
var prnt = item.parentNode.parentNode.parentNode.parentNode.parentNode;
prnt.style.display = "none";
}
});
}
complete();
});
/* Use the AFTERLOADWIDGET coordination topic handler to release the controller binding for the editable. */
/* Since the prop controller can be shared, doing this in the AFTERLOADWIDGET ensures no other widget overrides your changes. */
coordination.participate(Constants.CoordTopic.AFTERLOADWIDGET, function(context, complete, abort) {
/* Release the controller binding for the editable. */
ControllerManager.unbind(workEdit);
/* Call the coordination completion method. */
complete();
});
});
}
}
1 comment:
Prince :)
Post a Comment