locked
Url Addressable Forms and Views problem RRS feed

  • Question

  • Recently, i am working on to make my custom entity form view to be "ReadOnly" based on current login users' role. Lets say if the user is in the "normal employee" role, when they open up the form, the form will only be read only. I am trying to achieve this by using the  Url Addressable Forms and Views way.

    I manage to get it works but the problem is the read only page open up keep refresh on its's own (keep blinking). Anyone have idea about this?

    Hereby paste my javascript:

    var url = "/" + organisation_name;

     // make the form "Read-Only"    

    window.location.href = url + '/_forms/readonly/readonly.aspx?objTypeCode=' + crmForm.ObjectTypeCode +'&id=' + crmForm.ObjectId 



    Friday, June 11, 2010 8:38 AM

Answers

  • Thanks for your reply. By the way i have solved the issue.

    I need to check the form type , if it is update mode then just call the function to check whether want to make it read only or not.

    eg:-

     

    onLoad= function()

    {

    if (crmForm.FormType == 2)

          {

                var url = "/" + organisation_name;

      // make the form "Read-Only"    

    window.location.href = url + '/_forms/readonly/readonly.aspx?objTypeCode=' + crmForm.ObjectTypeCode +'&id=' + crmForm.ObjectId 

          }

    }

     

    Hope this can help others too. :)

    Friday, June 11, 2010 9:38 AM

All replies

  • If you have put your code on OnLoad event, then redirection to readonly page happens each time it is loaded no matter of is it readonly or not. So, you should check previously if your url already contain for example string "_forms/readonly/readonly.aspx" in it.

    Hope it will help


    Oleksandr Klymenko,
    My Blog: www.darkaxe.wordpress.com
    Friday, June 11, 2010 8:46 AM
  • Thanks for your reply. By the way i have solved the issue.

    I need to check the form type , if it is update mode then just call the function to check whether want to make it read only or not.

    eg:-

     

    onLoad= function()

    {

    if (crmForm.FormType == 2)

          {

                var url = "/" + organisation_name;

      // make the form "Read-Only"    

    window.location.href = url + '/_forms/readonly/readonly.aspx?objTypeCode=' + crmForm.ObjectTypeCode +'&id=' + crmForm.ObjectId 

          }

    }

     

    Hope this can help others too. :)

    Friday, June 11, 2010 9:38 AM