B2B Service

Get Involved. Join the Conversation.

Topic

    Hamzeh Al Karmi
    Unable to find the Method Name in the Actions and Links...Answered
    Topic posted May 15, 2019 by Hamzeh Al KarmiSilver Medal: 2,000+ Points 
    70 Views, 15 Comments
    Title:
    Unable to find the Method Name in the Actions and Links screen.
    Summary:
    After entering a script and saving the script I am unable to find the Method Name in the Actions and Links screen.
    Content:

    Hello All,

    I am in the Actions and Links screen for the Accounts object. I added an Action button and a script that when pressed, changes the value of a certain field. After saving the script in the Edit Object Function screen, I select the list of value Method Name but cannot find the Function name I created.

    Is this a bug?

    Best Comment

    Reghu

    The return type should be 'void' inorder to use the method in actions.

    Comment

     

    • Reghu

      What is the return type of the object function?  Could you attach a screenshot of the function?

    • Reghu

      The return type should be 'void' inorder to use the method in actions.

      • Hamzeh Al Karmi

        I'll change the return type to void. But let me give you a detailed description of the issue I'm facing.

        I created a custom field called Email Credentials Sent which is a list of value with two values (Yes and No) the API name is EmailCredentialsSent_c. What The Action button should do is change the value of the read-only custom field to Yes and in return through customizing the Accounts object in the workflow, an email should be sent to the contact. The script I have is:

        setAttribute("EmailCredentialsSent_c", "CUSTOM_YES");

        It is defined in the Method name I am trying to display.

      • Hamzeh Al Karmi

        I made the return type to Void and selected the method name. But the application does not display the Action button that I created. What could be the problem?

    • Reghu

      So, now you ar eable to select the method, but the action is not appearing in page layouts for exposing?

      • Hamzeh Al Karmi

        I displayed the action button. The problem was as you said that it should be void. But may I ask a different question since I have you here?

    • Reghu

      Ok Glad that I could be of help in resolving the problem.

       

      Yes, plz.

      • Hamzeh Al Karmi

        Thank you Reghu. I truly appreciate it. 

        Ok so in the Workflow object I have the script:

        if (isAttributeChanged('EmailCredentialsSent_c') && EmailCredentialsSent_c == 'Yes')
        return true;

        1- For the API EmailCredentialsSent_c should I write the value Yes or the lookup value?

        2- If I let the custom field be read-only and run the script can the application change the value? If not can I have a script that when the value turns to Yes the field becomes read-only?

        Sorry for the constant questions but I am new to scripting and have no experience at all in it.

    • Reghu

      1- For the API EmailCredentialsSent_c should I write the value Yes or the lookup value?  Since its Choice list field, you should use lookup code of the field. 

      2- If I let the custom field be read-only and run the script can the application change the value? If not can I have a script that when the value turns to Yes the field becomes read-only?   So, what I understand is, you want to make the field readonly to users, but through script it should be editable.  If yes, then change the updateable property of the field to condtional and inside the expression write 'return false'. 

      • Hamzeh Al Karmi

        Thank you Reghu,

        But what I meant in my second question is that when the value of the field becomes Yes. It should become read-only. How can I do this?

      • Hamzeh Al Karmi

        Also should the lookup code value be between single quotation or no quotations at all?

      • Hamzeh Al Karmi

        The reason why I am asking these questions because the email is not being sent even though the script I have written seems to be correct.

      • Hamzeh Al Karmi

        Never mind it worked :) Thank you Reghu. One finnnaaaal tiny question. Can I send an email to a list of contacts using script (mass amount of contacts)?