• Gaston Lefer
  • NEWBIE
  • 29 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 17
    Replies
Create lightning component that is externally available that will create a case in Salesforce. Pretty much a component that works like a a web to case
Create visualforce page that is externally available that will create a case in Salesforce. Pretty much visuakforce page that works like a a web to case
var action = component.get("c.fetchUser");

            action.setCallback(this, function(response) {
                var state = response.getState();
                if (state === "SUCCESS") {
                    var storeResponse = response.getReturnValue();
                   // set current user information on userInfo attribute
                    component.set("v.userInfo", storeResponse);

                   // @@@@@ set default value here @@@@
                    var getContactId = component.get("v.userInfo.ContactId");
                    component.set("v.lookupcase.ContactId" , getContactId ) ;
            });
            $A.enqueueAction(action);


    <aura:attribute name="lookupcase" type="Case" default="{
            'sobjectType': 'Case',
            'ContactId': '',}"/>                                             
    <force:inputField value="{!v.lookupcase.ContactId}" class="slds-input"/>

Thsi doesn't works, what am I missing?
How do you set a dynamic aura attribute default value like current userinfo instead of hardcoding. See below.

The harcoding accountid works, not dynamic contactid/not supported.
 
<aura:attribute name="lookupcase" type="Case" default="{
		'sobjectType': 'Case',
        'ContactId': '{!v.userInfo.ContactId}',                                                
        'AccountId': '0012D000002oAkt'  
                                                         
	}"/>

 
Just trying to display the current user info on a lightning page
1var userId =$A.get("$SObjectType.CurrentUser.Id");
2Console.log(userId);
Create visualforce page that is externally available that will create a case in Salesforce. Pretty much visuakforce page that works like a a web to case
var action = component.get("c.fetchUser");

            action.setCallback(this, function(response) {
                var state = response.getState();
                if (state === "SUCCESS") {
                    var storeResponse = response.getReturnValue();
                   // set current user information on userInfo attribute
                    component.set("v.userInfo", storeResponse);

                   // @@@@@ set default value here @@@@
                    var getContactId = component.get("v.userInfo.ContactId");
                    component.set("v.lookupcase.ContactId" , getContactId ) ;
            });
            $A.enqueueAction(action);


    <aura:attribute name="lookupcase" type="Case" default="{
            'sobjectType': 'Case',
            'ContactId': '',}"/>                                             
    <force:inputField value="{!v.lookupcase.ContactId}" class="slds-input"/>

Thsi doesn't works, what am I missing?
How do you set a dynamic aura attribute default value like current userinfo instead of hardcoding. See below.

The harcoding accountid works, not dynamic contactid/not supported.
 
<aura:attribute name="lookupcase" type="Case" default="{
		'sobjectType': 'Case',
        'ContactId': '{!v.userInfo.ContactId}',                                                
        'AccountId': '0012D000002oAkt'  
                                                         
	}"/>

 
Just trying to display the current user info on a lightning page
1var userId =$A.get("$SObjectType.CurrentUser.Id");
2Console.log(userId);