top of page
Paulo Correia

ServiceMax Go App with Lightning

Updated: Dec 14, 2021

One of the biggest challenge with servicemax Go app is that it does not support lightning.

To solve this limitation we need to leverage lightning out app technology.


There are a few components that we must put together in order to make it work.


At high level we will need the following:

  1. Visualforce page with Lightning app.

  2. An aura component

  3. A Sevicemax/wizard button with a parameter (record id) and then link it to the visualforce page.

High Level Structure:




For example


VisualForce page Name : WorkOrderOnlineActionsVF

<apex:page standardcontroller="SVMXC__Service_Order__c" sidebar="false" showHeader="false">
     <apex:includeLightning />
    <div id="WoRestriction"></div> 
 <script>
      // Here 'VfApp' Is Lightning Application Name
    $Lightning.use("c:WorkOrderOnlineActionsApp", function() {
      /* 'LcForVf' is Lightning Component Name which we are Displaying In Vf Page 
       * syntax for create lightning component dynamically :
       * $Lightning.createComponent(String type, Object attributes, String locator, function callback) */
    // WorkOrderOnlineActions -- This is Lightning Out App
    $Lightning.createComponent("c:WorkOrderOnlineActions",
    { 
      // Set Lightning Component Attributes Property before creating Lightning Component In Visualforce page 
        //textColor : "Red",
        //currentUserName : '{!$User.FirstName} {!$User.LastName}' ,
        "recordId" : "{!$CurrentPage.parameters.id}"
    },
   "WoRestriction",
    function(component) {
        // create component Callback, Lightning Component has been Created,
        // Now you can set more lightning Component attributes here,
        // and do more cool stuff here
        component.set("v.recordId" , '{!$CurrentPage.parameters.id}');
    });
 });
 </script>
</apex:page>

Lightning Out App : WorkOrderOnlineActionsApp.app

<aura:application extends="ltng:outApp" >
    <!-- Declaring the aura component (WorkOrderOnlineActions) dependency -->
    <aura:dependency resource="c:WorkOrderOnlineActions"/>  
</aura:application>

Aura Component : WorkOrderOnlineActions.cmp

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> 
    <aura:attribute name="woName" type="string"/>
    <b>Work Order: {!v.woName}</b> 
    <lightning:tabset>
        <lightning:tab label="Chatter">
            <forceChatter:publisher context="RECORD" recordId="{!v.recordId}"/> <br/>
            <forceChatter:feed type="Record" subjectId="{!v.recordId}"/>
        </lightning:tab>
        <lightning:tab label="Routine Maintenance" title="2nd tab extended title">
            <c:Go_RoutineMaintainceLanguage workOrderValId="{!v.recordId}"></c:Go_RoutineMaintainceLanguage>
        </lightning:tab>
        <lightning:tab label="Resources">
            <lightning:formattedUrl value ="https://xxxxxxxx.sharepoint.com/sites/xxxxxxxxx/Pages/Home.aspx" label="Field Service Support"/> 
        </lightning:tab>
    </lightning:tabset>
</aura:component>






40 views1 comment

Recent Posts

See All

1 комментарий


Paulo Correia MicroSumol
Paulo Correia MicroSumol
13 дек. 2021 г.

Exactly what I was looking for

Лайк
bottom of page