6

I have a lightning quick action that needs to check the sObjectName to trigger a conditional action that will fill some fields depending on it.

The problem that I encounter is that when using the implements for the lightning quick action and the hasSObjectName the value is empty but I can get the recordId using the same method and there's no error.

<aura:component description="ClonePricebook"
                implements="flexipage:availableForAllPageTypes,
                flexipage:availableForRecordHome,
                force:lightningQuickAction,
                force:hasRecordId,
                force:hasSObjectName"
                access="global">
<p>{!v.recordId}</p> //Filled
<p>{!v.sObjectName}</p> // Empty
</aura:component>

According to the release notes of Summer 17 (https://releasenotes.docs.salesforce.com/en-us/summer17/release-notes/rn_lightning_force_hassobjectname.htm) I should be able to use it inside a quick action.

Why can't I get the sObjectName in this case ?

5

Can you re-check this please. Because I tried the exact same code in my org and its working fine.

Please check the screen shots -

Component

Adding action button

Click on actin button

Note - Can you check your component version number once. Mine is 40 and it works fine.

  • The version was Right, it was 40 from the Start. The only difference is that I created a global action and not an action on that particular (custom) object. So Apparently it does not work on a global action. I am marking you as the right answer as you made me realise and test this situation. Thanks ! – Cyril Detrain Jun 17 '17 at 11:43
  • Yes, correct it doesn't work for global action. I didn't knew that you have created global action. Thanks :) – Mustafa Jhabuawala Jun 17 '17 at 18:50
0

EDIT: According to the docs - you don't need attribute.

Did you declare and attribute for it?

<aura:attribute name="sObjectName" type="String" />

Also, is your component bundle version 40?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.