Example of Creating Actionable Infolet Custom Actions

You can create custom smart action for actionable infolets to update sales information but the actions can't open pages or navigate to them.

For example, you can create a smart action to update the stage of an opportunity or postpone the opportunity close date by one day, but you can't have the action open the edit opportunity page.

Here's how to create a custom smart action to postpone an opportunity close date by one day for My Opportunities actionable infolet.

Note: While you can create the action directly, this example has you create a server script first. That's because the server script includes the Expression Palette to help you write and validate your EL Expression script.
  1. Create and enter a sandbox with Application Composer and Page Composer as your tools.

  2. Create the Groovy script as an object function server script in Application Composer:

    1. In Application Composer, open the object node in the left portion of the page, Standard Objects > Opportunity in this example.

    2. Click Server Scripts.

    3. In the Server Scripts page, click Object Functions.

    4. Enter a function name, no spaces permitted. For example: Defer_1_Day.

    5. Enter the EL Expression script in the Edit Script box. You can use the Expression Palette to find the technical names of fields and insert elements of your script. Here's how to find the technical name for the opportunity Close Date field:

      1. Click Show/Hide Expression Palette (the function icon highlighted in the screenshot).

        Detail of the Server Scripts page, highlighting the Show/Hide Expression Palette button.
      2. Click Fields.

      3. Select the object, Opportunity in this example, and scroll down.

        Detail of the Server Scripts page, showing the technical name for Close Date.
      4. In Opportunity: Fields section, search for the technical field name by the display label: Close Date.

        The technical name displays in the API Name column.

      5. You can insert the technical name into your script by clicking Edit Script > Insert.

      To learn more about how to best use the features available in the expression builder when writing scripts, see "Groovy Tips and Techniques" in the Groovy Scripting Reference guide.

  3. When your script is complete, click Validate.

    Here's an example of the script to postpone the due date by one day: setAttribute("EffectiveDate",EffectiveDate + 1);

  4. When your script validates without errors, click Save and Close.

  5. In the object list in the left side of the Application Composer page, click Actions and Links.

  6. In the Opportunity: Actions and Links page, click Create.

  7. In the Create Action or Link page, Display Label field, enter the action name that users see in the infolet actions list.

  8. Select the After the Script: Save the record and return to the previous page option.

  9. In the Script section, click Method Name and select the script name from the list.

  10. Click Save.

  11. While still in the sandbox, click Home to get back to the Welcome page.

  12. From the sandbox Tools menu, select Page Composer. The Page Composer toolbar displays underneath the sandbox toolbar.

  13. Scroll down to the My Opportunities infolet.

  14. Make sure you're in the Expanded View. This is the view of the infolet showing the different filters.

  15. Click Actions (the triangular icon at the top right corner of the infolet) and select Configure.

  16. Move the action you created, Defer 1 Day, to the Selected column.

  17. Click Save and Close.

  18. In the Page Composer toolbar, click Close to save your work.

    The Page Composer toolbar disappears.

  19. To see the new action you created, the infolet must display at least one opportunity. A setup user generally can't access opportunities, so you must publish the sandbox without testing. From the sandbox Action menu, select Publish.

  20. After publishing is complete, sign out and sign in again as a salesperson or another user who owns an opportunity.

  21. With at least one opportunity displayed in the My Opportunities infolet, you can view the new action in the list.