Field Service

Get Involved. Join the Conversation.

Topic

    Anil Kumar
    Not able to send Data from Plugin Iframe to Field Service...
    Topic posted January 29, 2019 by Anil KumarBlue Ribbon: 750+ Points, tagged Configuration, Mobility / Mobile Apps 
    62 Views, 4 Comments
    Title:
    Not able to send Data from Plugin Iframe to Field Service Cloud Screen
    Summary:
    Not able to send Data from Plugin Iframe to Field Service Cloud Screen Name (cname) Field
    Content:

    Hi,

    We have a requirement to make the Name Filed searchable in Book Activity Screen (Mobility), so that Technician can search customer name instead of Typing. To achieve this functionality, we built a Plugin which opens an iframe. After selecting the value in iframe, it should stamp the selected value in the Name (cname) Field of Book Activity Screen.

    But after selecting the value and submitting. the value is not getting stamped in the Name Field of Book Activity Screen and also not navigating back to the Book Activity Screen. Please help. The files created for Plugin development are attached.

    Thanks,

    Anil

    Version:
    18D
    Document:
    Select.zip (14KB)

    Comment

     

    • Graham Sawell

      Hi Anil,

      The plugin API can only interact with activities that exist, so when you fire the postMessage back with a close method, when it comes to activities unless you specify an activity id (aid), no data will be modified. Because the activity has not yet been created, there is no activity ID.

      I haven't managed to find a workaround for this within the limitations the plugin API sets. There is no method for creating an activity using the plugin framework, which is a shame as it limits the possibilities with the framework - that is, unless you are happy to sacrifice offline functionality and create activities using the standard API. Native OFSC will create an activity offline, but we can't access this functionality.

      What I have done in the past is to move the plugin functionality to once the activity has been created, so the user is creating more of a placehoder.

      However, given that you are looking to implement this functionality within the book feature, I presume you're looking to query capacity? If so, an online plugin is your only option to safely avoid booking conflicts. I have developed booking plugins with integrated calendars, timeslot selection for OFSC customers in the past and am very familiar with the quirks if you are looking for guidance.

      Hopefully this provides some insight. My email is graham [at] sawell.co.uk if you have any more questions or want to get in touch.

    • Anil Kumar

      Hi Graham,

      We are able to postmessage (JS) from Plugin iframe through Close Method as shown in the screenshot attached. But the value is not populated in the Name Field in OFSC, We are not sure the "addEventListener" (JS) is receiving the message and populating it into the Field in OFSC. Do we need to update any code from OFSC Server side to receive the values from Plugin iframe. The screenshot is attached for your reference.

      We want to select the Customer Name before creating any activity from Book Activity Screen. The Customer Names should be populated from Mobile Device Local Storage. Please help.

      Thanks,

      Anil.

    • Anil Kumar

      Hi,

      Iam trying to update the custom field in activity details screen through the plugin. But i am getting the below error message and was not able to find any information on this. Could you please help me on this and please let me know if you need more information. the plugin files are attached here for your reference. 

      File Name : Select_VIN_22Feb2019.zip

      [Plugin API] {
          "apiVersion": 1,
          "method": "error",
          "entity": "activity",
          "errors": [
              {
                  "type": "TYPE_ENTITY_FORMAT",
                  "code": "CODE_ENTITY_ID_INVALID",
                  "entity": "activity"
              }
          ]
      }

      Thanks,

      Anil

    • Anil Kumar

      Hi Friends,

      I am able to update a Custom Property in Activity Details screen through the Plugin. I have update the plugin.js file and below is the working code of Close Method Section here for the benefit of everyone.

      {
        activity: {
      vin: $('.myInput').val(),
      aid: actid
        },
                      apiVersion: 1,
                      backScreen: 'default',
                      method: 'close'
                  };

      vin : Custom Property

      myInput : declared as class in "index.html" file to capture input value

      actid : declared as global variable in "plugin.js" file to capture activity id and pass to Close Method section

      Thanks,

      Anil