2. On Click of case Reject button, show popup with reject reason text, once filled and submitted, reject reason field should get filled and case should be in read only

 

User Story: On Click of case Reject button, show popup with reject reason text, once filled and submitted, reject reason field should get filled and case should be in read only?

1.       Create one Reject Reason field with single Line Text data type

2.       Create one Reject button by using XRM Tool box

3.       Create HTML Web resource

4.       Create JavaScript Web resource call html web resource here

5.       Call JavaScript function from Rejected button

6.       Write a JavaScript function for case read-only mode and call it from reject button

 

Create one Reject Reason field with single Line Text data type & Create one Reject button by using XRM Tool box



 

Create HTML Web resource

<!DOCTYPE html> 

<html>

<head>

    <meta charset="utf-8" />

    <title></title>

</head>

<body>

    <script>

        function submitClick()

        {

            let reject = document.getElementById("Reject_Reason").value;

            window.returnValue = reject;

            window.close();

        }

        function cancelClick()

        {

            window.close();

        }

    </script>

    <form>

        <input type="text" id="Reject_Reason" name="Reject Reason" placeholder="Enter your reject reason" />

        <input type="submit" value="Submit" onclick="submitClick()" />

        <input type="button" value="Cancel" onclick="cancelClick()" />

    </form>

</body>

</html>

 Create JavaScript Web resource call html web resource here

function rejectReason(primaryControl)

{  

    var pageInput =

    {

        pageType: "webresource",

        webresourceName: "crb67_EffiHTMLPage_RejectReason" 

    };

    var navigationOptions =

    {

        target: 2,

        width: 120,

        height:100,

        position: 1,

        title: "Reject_Reason"

    };

    Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(

        function success(rejectText)

        {      

            if (rejectText.returnValue != null)

            {

                primaryControl.getAttribute("crb67_rejectreason").setValue(rejectText.returnValue); 

            }                         

        },

        function error()

        {

            Xrm.Navigation.openAlertDialog({ text: error. Message });

        }

    );

}

Write a JavaScript function for case read-only mode when click on reject button and call it from reject button

 

function readOnly(primaryControl) { 

    var formContext = primaryControl; 

    var formControls = formContext.ui.controls; 

    formControls.forEach(control => {    

             control.setDisabled(true);     

     });

}

Out Put:

1.Enter the reject reason



2. Reject reason updated



3.  Record went to the read only mode



Comments

Popular posts from this blog

8. On selection of asset in case entity, read the project in asset, project start date and end date from project entity, set the dates on case entity from as project start date and end dates

1. In Case Entity, based on Incident Type selection, filter the case category using the category-incident master entity