how to prevent module editing depending on status 'Completed'

I am a beginner on Sugar...

My target is prevent module editing.

I wrote down ......this.$('.record-edit-link-wrapper').remove(); 
 and it works....
but i want to disabled icon-pencil (it is my biggest problem) on each field ....In order to prevent editing if status is Completed...
How can do it?
Sugar 7.5.1 pro
Parents
  • thank you Francesca,
    I didn't explain it very well

    I need to use my static funtion because i have to respect other conditions
    for example i am not allow to go to back to the status "NEW" if the status is different to "NEW",  so i need to know the previous status  (i retrieve it from my static function and i return the correct message to give to user) and not only the current status ....for this reason i am using app.api.call
    Please can you give me any advise?....i'm a beginner on Sugar   Ciao
  • You should be able to fit your API into the code I sent above

    Instead of 
        var status = this.model.get(‘status');
        if (status == ‘Completed'){ 
    in each of the functions above use a check on your API call.

    Note that success/error refers to the ability of the API to execute.
    So if your API executes correctly you will have success and the output from the api "data" might be "false" if you are not allowed to edit .

    Inside the success check the output of your API to see if you want to allow edit or not and then use the code inside the if statements to disable the edit.

    You may need to review APIs to make sure you're getting what you want.
    Sorry but I don't have time to go deeper on this right now.

    FrancescaS
Reply
  • You should be able to fit your API into the code I sent above

    Instead of 
        var status = this.model.get(‘status');
        if (status == ‘Completed'){ 
    in each of the functions above use a check on your API call.

    Note that success/error refers to the ability of the API to execute.
    So if your API executes correctly you will have success and the output from the api "data" might be "false" if you are not allowed to edit .

    Inside the success check the output of your API to see if you want to allow edit or not and then use the code inside the if statements to disable the edit.

    You may need to review APIs to make sure you're getting what you want.
    Sorry but I don't have time to go deeper on this right now.

    FrancescaS
Children
No Data