• Soham SFDC
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies

Hi,

My requirement is like this: I had a Javascript button which used to Update the Status field and a Custom field in Case Record. Now, the Javascript button needs to be changed since it is not supported in Lightning. My approach is to create a Visualforce page which calls a Lightning component. But, now I am facing 2 problems:

  1. After the record has been saved, the Case record page does not get refreshed.
  2. The Modal popup window which asks for a Confirmation before saving the record is not getting closed. My code is like this:

VF Page:

<apex:page showHeader="false" standardController="Case" standardStylesheets="false" sidebar="false">
  <script src="/soap/ajax/38.0/connection.js" type="text/javascript"/>
  <script src="/soap/ajax/38.0/apex.js" type="text/javascript"/>
  <!-- Load Lightning dependencies -->
  <apex:includeLightning />

  <div class="slds">
    <!-- Target div for the Lightning component -->
    <div id="RequestEscalationManagement"></div>
  </div>

  <script type="text/javascript">
    var recordId = '{!Case.Id}';
    var myUserContext = "{!$User.UITheme}";

    $Lightning.use("c:REM", function() {
      var attributes = {
        recordId: recordId
      };

      var targetElementId = 'RequestEscalationManagement';

      $Lightning.createComponent('c:RequestEscalationManagement', attributes,targetElementId,
        function(cmp) {
          /*if (sforce.one != undefined) {
              // Lightning
              console.log('Lightning component');
              sforce.one.navigateToSObject(recordId);
          } else {
              // Classic
              window.parent.location = '/' + recordId;
          }*/
          console.log('Finished');
      });
    });
  </script>
</apex:page>


RequestEscalationManagement.cmp:

<aura:component controller="REMApexController" implements="force:lightningQuickAction,force:hasRecordId,flexipage:availableForRecordHome,flexipage:availableForAllPageTypes">
	<aura:attribute name="recordId" type="Id" />
    <aura:attribute name="hasErrors" type="Boolean" />
    
    <!-- <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> -->
    
    <aura:if isTrue="{!v.hasErrors}">
        <div class="recordSaveError">
            <ui:message title="Error" severity="error" closable="true" >
               An error was encountered trying to save the record
            </ui:message>                                                     
        </div>
    </aura:if>

    <div class="demo-only"  style="height: 100%;">
        <section  class="slds-modal slds-fade-in-open">
            <div class="slds-modal__container">
                <header class="slds-modal__header">
                    <button class="slds-button slds-modal__close" title="Close" 
                            onclick="{!c.closeMe}">
                        <lightning:icon class="white slds-icon_small" iconName="utility:close"/> 
                        <span class="slds-assistive-text">Close</span>
                    </button>
                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">
                        Confirm</h2>
                </header>
                <div class="slds-modal__content slds-p-around_medium" > 
                    Please confirm if this needs to be escalated.
                </div>
                <footer class="slds-modal__footer"> 
                    <button class="slds-button slds-button_brand" onclick="{!c.doInit}">Ok</button>
                    <button class="slds-button slds-button_brand" onclick="{!c.closeMe}">Cancel</button>
                </footer>
            </div>
        </section>
        <div class="slds-backdrop slds-backdrop_open"></div>
    </div>

</aura:component>
RequestEscalationManagementController.js:
({
    doInit: function(component, event, helper) {
        
            var action = component.get("c.saveRecordCtrl");
            action.setParams({
                "caseRecordId": component.get("v.recordId")
            });
            action.setCallback(this, function(response) {
                var state = response.getState();
                var caseId = component.get("v.recordId");
                if(component.isValid() && state == "SUCCESS"){
                    console.log('Success');
                    if (sforce.one != undefined) {
                        // Lightning
                        component.destroy();
                        sforce.one.navigateToSObject(caseId);
                    } else {
                        // Classic
                        window.parent.location = '/' + caseId;
                    }
                } else {
                    console.log('Error trying to save Case Record');
                }
            });
            $A.enqueueAction(action);
    },
    closeMe : function(component, event, helper) {
        var caseId = component.get("v.recordId");
        console.log('caseId: ' + caseId);
        if (sforce.one != undefined) {
            // Lightning
            console.log('Lightning component');
            sforce.one.navigateToSObject(caseId);
        } else {
            // Classic
            window.parent.location = '/' + caseId;
        }
        helper.closeMe(component, event, helper);
    }
})
RequestEscalationManagementHelper.js
({
	closeMe : function(comp, event, helper)  { 
        comp.destroy();
	}
})
After clicking on OK button, the cursor goes back to the 1396 record but, it does not refresh the page. Also, the current window highlighted in Red box does not get closed.
User-added image

Hi All,

I am pretty new to Lightning. I am facing a problem with a Quick Action on Case Record. 

I have added a Lightning Component Type Quick Action named "REM" in the Case Layout's "Salesforce Mobile and Lightning Experience Actions" section. But, somehow the "REM" quick action is coming in the Feed Tracking tab rather than as a Quick Action for the Case Record.

User-added image

Please can you point me in the correct direction about what I might be doing wrong.

Regards,
Soham

Hi All,

We are trying to call an external Webservice which is returning a ByteCode response. Is there a way out to generate a PDF from this ByteCode in Salesforce?

Sample response: 
{"FINISHED":[{"PDF REPORT":[37,80,68,70,45,49,46,52,10,37,-57,-27,-12,-27,-16,10,51,32,48,32,111,98,106,10,37,32,91,50,52,93,32,10,60,60,10,47,70,105,108,116,101,114,32,47,70,108,97,116,101,68,101,99,111,100,101,10,47,76,101,110,103,116,104,32,50,50,48,57,10,62,62,10,115,116,114,101,97,109,10,120,-38,-19,91,-1,111,-30,56,22,-1,-71,-4,21,-42,74,39,-51,72,83,-42,95,19,-89,-46,-4,64,33,-35,97,-81,5,22,50,-70,61,109,79,-89,20,-36,54,43,72,104,8,116,122,127,-3,57,-95,-99,-30,-106,-114,-99,96,-46,-10,110,-87,-96,52,6,127,-34,123,126,95,62,-49,113,111,26,127,3,-125,14,61,59,5,43,-111,46,-94,36,62,2,-124,-77,-53,111,4,12,-46,68,-114,-3,-38,-7,-5,-29,8,106,-70,77,-8,111,-54,-28,-11,-2,-24,-15,-14,105,20,47,-65,1,-36,116,-102,-120,31,34,-113,54,97,-15,67,-102,98,-102,127,-12,36,-102,10,32,-30,113,50,-119,-30,-85,35,-16,53,56,57,-28,-14,114,20,103,34,-99,39,-45,48,19,71,32,75,-105,-94,-72,-74,16,-39,-30,8,-4,25,-82,-62,102,120,-101,53,-69,-59,-123,63,-78,100,-2,25,-63,79,83,113,-103,125,-122,-97,46,-110,44,75,102,-7,-123,52,-70,-70,-106]}]}

I have trimmed the Sample response as the actual response was pretty huge.

I have already tried the solution that was provided by Willem Mulder in the link given below but still I received the error :
"System.StringException: Unrecognized base64 character: ."
http://salesforce.stackexchange.com/questions/81576/convert-byte-array-jsonarray-to-base-64-string-via-apex

I am using a Field Service Lightning flow to display a custom formula field called Subtotal - the formula Subtotal field is a currency field to 2 decimal places.
I have a screen element that has a Display Text inside it which is displaying the Subtotal field.
In the flow debug screen it is showing the value correctly as 2 decimal places, however, when I log into the Field Service Lightning app it shows the value to 6 decimal places

FYI - we do not have multi currency enabled

Has anyone come across this before? 

ThanksApp screen on right, desktop detail page on left

Hi,

My requirement is like this: I had a Javascript button which used to Update the Status field and a Custom field in Case Record. Now, the Javascript button needs to be changed since it is not supported in Lightning. My approach is to create a Visualforce page which calls a Lightning component. But, now I am facing 2 problems:

  1. After the record has been saved, the Case record page does not get refreshed.
  2. The Modal popup window which asks for a Confirmation before saving the record is not getting closed. My code is like this:

VF Page:

<apex:page showHeader="false" standardController="Case" standardStylesheets="false" sidebar="false">
  <script src="/soap/ajax/38.0/connection.js" type="text/javascript"/>
  <script src="/soap/ajax/38.0/apex.js" type="text/javascript"/>
  <!-- Load Lightning dependencies -->
  <apex:includeLightning />

  <div class="slds">
    <!-- Target div for the Lightning component -->
    <div id="RequestEscalationManagement"></div>
  </div>

  <script type="text/javascript">
    var recordId = '{!Case.Id}';
    var myUserContext = "{!$User.UITheme}";

    $Lightning.use("c:REM", function() {
      var attributes = {
        recordId: recordId
      };

      var targetElementId = 'RequestEscalationManagement';

      $Lightning.createComponent('c:RequestEscalationManagement', attributes,targetElementId,
        function(cmp) {
          /*if (sforce.one != undefined) {
              // Lightning
              console.log('Lightning component');
              sforce.one.navigateToSObject(recordId);
          } else {
              // Classic
              window.parent.location = '/' + recordId;
          }*/
          console.log('Finished');
      });
    });
  </script>
</apex:page>


RequestEscalationManagement.cmp:

<aura:component controller="REMApexController" implements="force:lightningQuickAction,force:hasRecordId,flexipage:availableForRecordHome,flexipage:availableForAllPageTypes">
	<aura:attribute name="recordId" type="Id" />
    <aura:attribute name="hasErrors" type="Boolean" />
    
    <!-- <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> -->
    
    <aura:if isTrue="{!v.hasErrors}">
        <div class="recordSaveError">
            <ui:message title="Error" severity="error" closable="true" >
               An error was encountered trying to save the record
            </ui:message>                                                     
        </div>
    </aura:if>

    <div class="demo-only"  style="height: 100%;">
        <section  class="slds-modal slds-fade-in-open">
            <div class="slds-modal__container">
                <header class="slds-modal__header">
                    <button class="slds-button slds-modal__close" title="Close" 
                            onclick="{!c.closeMe}">
                        <lightning:icon class="white slds-icon_small" iconName="utility:close"/> 
                        <span class="slds-assistive-text">Close</span>
                    </button>
                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">
                        Confirm</h2>
                </header>
                <div class="slds-modal__content slds-p-around_medium" > 
                    Please confirm if this needs to be escalated.
                </div>
                <footer class="slds-modal__footer"> 
                    <button class="slds-button slds-button_brand" onclick="{!c.doInit}">Ok</button>
                    <button class="slds-button slds-button_brand" onclick="{!c.closeMe}">Cancel</button>
                </footer>
            </div>
        </section>
        <div class="slds-backdrop slds-backdrop_open"></div>
    </div>

</aura:component>
RequestEscalationManagementController.js:
({
    doInit: function(component, event, helper) {
        
            var action = component.get("c.saveRecordCtrl");
            action.setParams({
                "caseRecordId": component.get("v.recordId")
            });
            action.setCallback(this, function(response) {
                var state = response.getState();
                var caseId = component.get("v.recordId");
                if(component.isValid() && state == "SUCCESS"){
                    console.log('Success');
                    if (sforce.one != undefined) {
                        // Lightning
                        component.destroy();
                        sforce.one.navigateToSObject(caseId);
                    } else {
                        // Classic
                        window.parent.location = '/' + caseId;
                    }
                } else {
                    console.log('Error trying to save Case Record');
                }
            });
            $A.enqueueAction(action);
    },
    closeMe : function(component, event, helper) {
        var caseId = component.get("v.recordId");
        console.log('caseId: ' + caseId);
        if (sforce.one != undefined) {
            // Lightning
            console.log('Lightning component');
            sforce.one.navigateToSObject(caseId);
        } else {
            // Classic
            window.parent.location = '/' + caseId;
        }
        helper.closeMe(component, event, helper);
    }
})
RequestEscalationManagementHelper.js
({
	closeMe : function(comp, event, helper)  { 
        comp.destroy();
	}
})
After clicking on OK button, the cursor goes back to the 1396 record but, it does not refresh the page. Also, the current window highlighted in Red box does not get closed.
User-added image

Hi All,

I am pretty new to Lightning. I am facing a problem with a Quick Action on Case Record. 

I have added a Lightning Component Type Quick Action named "REM" in the Case Layout's "Salesforce Mobile and Lightning Experience Actions" section. But, somehow the "REM" quick action is coming in the Feed Tracking tab rather than as a Quick Action for the Case Record.

User-added image

Please can you point me in the correct direction about what I might be doing wrong.

Regards,
Soham

However, I have added all the items listed as far as I can tell (I've looked and relooked, not sure what I'm missing) Can anyone tell me what I did wrong?

User-added image