I have an edit form that opens up in a modal dialog box. I need to navigate it to different forms on SAVE/CANCEL clicks as per the user-group of currently logged in user.
For eg, project leaders to navigate back to My Quotes Finance team to navigate back to All quotes, etc...
(as of now all users get redirected to My Quotes)
Here is the piece of code of the modal box: How do I update the code to change its navigation rules?
<script type="text/javascript" src="/staging/CEIT/SiteAssets/Scripts/jquery.SPServices-2014.02/jquery.SPServices-2014.02.min.js"></script>
<script src="http://code.query.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
document.getElementById("Approval").addEventListener ("click", displayLayover, false);
function displayLayover()
{
JSRequest.EnsureSetup();
var issueID = JSRequest.QueryString["ID"];
var options = new Array();
options.url = '/sites/CEIT/Lists/QuoteSystemCEIT/Edit_Assigned.aspx?ID=' + issueID;
options.allowMaximize = true;
options.showClose = true;
options.dialogReturnValueCallback = Function.createDelegate(null, CloseDialogCallbackAssign);
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}
function CloseDialogCallbackAssign(dialogResult, returnValue)
{
if(dialogResult == SP.UI.DialogResult.OK)
{
SP.UI.Status.removeAllStatus(true);
SP.UI.ModalDialog.RefreshPage(dialogResult);
//window.location.replace('/sites/CEIT/SitePages/My%20Quote%20Requests.aspx');
//SP.UI.Status.removeAllStatus(true);
SP.UI.ModalDialog.RefreshPage(dialogResult);
alert("hi");
$().SPServices({
operation:"GetGroupCollectionFromUser",
userLoginName:$().SPServices.SPGetCurrentUser(),
async:false,
completefunc: function (xData, Status) {
if (($(xData.responseXML).find("Group[Name='Finance group']").length == 1)||($(xData.responseXML).find("Group[Name='Marketing Group']").length == 1)||($(xData.responseXML).find("Group[Name='Quote Team']").length == 1))
{
alert("I am not a leader");
window.location.replace('/sites/CEIT/SitePages/All%20Quote%20Requests.aspx');
}
else if (($(xData.responseXML).find("Group[Name='Project Leader']").length == 1))
{
alert("I am leader");
window.location.replace('/sites/CEIT/SitePages/My%20Quote%20Requests.aspx');
}
}});
}
else if(dialogResult == SP.UI.DialogResult.cancel)
{
SP.UI.Status.removeAllStatus(true);
}
}</script>