• JAGDISH MORE
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
ParentComponent:-
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
    <aura:attribute name="Name" type="String" default="---------------- This is a Parent Message------------" />
    <Canteen:ChildComponent aura:id="childCmp"/>
          <lightning:button variant="brand" label="Call Aura Method"
                          onclick="{!c.callAuraMethod}" />
    <p>"{!v.Name}"</p>
</aura:component>

parentcomponentcontroller:-
({
    callAuraMethod : function(component, event, helper) {
           var childCmp = component.find("childCmp");
            var retnMsg = childCmp.childMethod('Amit');
        component.set("v.Name",retnMsg);
    }
})

Childcomponent:-
<aura:component >
    <aura:method name="childMethod" action="{!c:getMessage}" access="public" description="Child Method">
        <aura:attribute name="Name" type="String" default="Jagdish"/>
    </aura:method>       
    {v.Name}
</aura:component>

Childcomponentcontroller:-
({
    getMessage : function(component, event) {
        var parameter = event.getParam('arguments');
        debugger;
        if(parameter){
            debugger;
            var par1 = params.Name;
            return "##############This is a message returned by the child whith parameter:: "+par1+"##############";
        }
        return "TEST";
    }
})
 Call to child component is not happning? I am not understanding why?
Apex Classes:-

public class GoogleDriveAuthenticationWithSalesforce {
//This class will authenticate with google and share Acces token to access google.
    private string key = '417326799289-4nfbtudddkb5naivirrber6jv45gi4td.apps.googleusercontent.com';
    private string secret = '4TSvsnB0t_55RVUGX4Y9DPZn';
    private string redirect_uri = 'https://'+System.URL.getSalesforceBaseUrl().getHost()+'/apex/GoogleDriveIntegration'; 
   public GoogleDriveAuthenticationWithSalesforce(){

    }
    
    public PageReference driveAuth(){
        PageReference pg= new PageReference(new AuthUriForApiRequest(key, redirect_uri).authenticationURI);
        return pg;
    } 

}


global class AuthUriForApiRequest {
    global string authenticationURI='';
    public AuthUriForApiRequest(String clientKey, String redirect_Uri){
        string key = EncodingUtil.urlDecode(clientKey, 'UTF-8');
        string uri = EncodingUtil.urlDecode(redirect_Uri, 'UTF-8');
        string authUri = 'https://accounts.google.com/o/oauth2/v2/auth?'+
                         'client_id='+key+//.apps.googleusercontent.com&'+
                         '&response_type=code'+
                         '&scope=openid%20email'+
                         '&redirect_uri='+uri+
                         '&state=security_token%3D138r5719ru3e1%26url%3Dhttps://oauth2-login-demo.example.com/myHome&'+
                         '&login_hint=jsmith@example.com&'+
                         'openid.realm=example.com&'+
                         'nonce=0394852-3190485-2490358&'+
                         'hd=example.com';

        authenticationURI = authUri;
    } 
}

Visualforce page:-
<apex:page Controller="GoogleDriveAuthenticationWithSalesforce">
    <apex:form>
     <apex:pageBlock>
        <apex:commandButton value="Authenticate" action="{!driveAuth}"/>
     </apex:pageBlock>
    </apex:form>
    
</apex:page>

Visualforce Page:-

User-added image

Here I am getting error:-
User-added image



Salesofrce MyDomain:-User-added image


When i tired to regester a my custom domain there also giving error:-
When i copy my custom domain and hit enter showing popup "must be a top level domain"

My problem is why google last shreenshot i am getting eorror must be a top level domain?
i know it is because my custom domain "testmycompany-dev-ed.my.salesforce.com" is a sub domain.
but please some one help me how to resolve this?

I have much eagerness to learn integration help me some one.
After creating 50 thousand Custom metadata record's in Salesforce Organisation, Will it make salesforce organisation work slow or will it make first time loading off Salesforce Organisation after log in?
Because this metadata will also be bring to the clint side when we log in to the Salesforce Organisation.
  
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AccountTemplatesTrigger: execution of AfterInsert

caused by: ahm.fflib_SObjectDomain.DomainException: Permission to create an AccountTemplete denied.

Class.ahm.fflib_SObjectDomain.handleAfterInsert: line 212, column 1
Class.ahm.fflib_SObjectDomain: line 377, column 1
Class.ahm.fflib_SObjectDomain.triggerHandler: line 330, column 1
Trigger.AccountTemplateTrigger: line 14, column 1: []
Apex Classes:-

public class GoogleDriveAuthenticationWithSalesforce {
//This class will authenticate with google and share Acces token to access google.
    private string key = '417326799289-4nfbtudddkb5naivirrber6jv45gi4td.apps.googleusercontent.com';
    private string secret = '4TSvsnB0t_55RVUGX4Y9DPZn';
    private string redirect_uri = 'https://'+System.URL.getSalesforceBaseUrl().getHost()+'/apex/GoogleDriveIntegration'; 
   public GoogleDriveAuthenticationWithSalesforce(){

    }
    
    public PageReference driveAuth(){
        PageReference pg= new PageReference(new AuthUriForApiRequest(key, redirect_uri).authenticationURI);
        return pg;
    } 

}


global class AuthUriForApiRequest {
    global string authenticationURI='';
    public AuthUriForApiRequest(String clientKey, String redirect_Uri){
        string key = EncodingUtil.urlDecode(clientKey, 'UTF-8');
        string uri = EncodingUtil.urlDecode(redirect_Uri, 'UTF-8');
        string authUri = 'https://accounts.google.com/o/oauth2/v2/auth?'+
                         'client_id='+key+//.apps.googleusercontent.com&'+
                         '&response_type=code'+
                         '&scope=openid%20email'+
                         '&redirect_uri='+uri+
                         '&state=security_token%3D138r5719ru3e1%26url%3Dhttps://oauth2-login-demo.example.com/myHome&'+
                         '&login_hint=jsmith@example.com&'+
                         'openid.realm=example.com&'+
                         'nonce=0394852-3190485-2490358&'+
                         'hd=example.com';

        authenticationURI = authUri;
    } 
}

Visualforce page:-
<apex:page Controller="GoogleDriveAuthenticationWithSalesforce">
    <apex:form>
     <apex:pageBlock>
        <apex:commandButton value="Authenticate" action="{!driveAuth}"/>
     </apex:pageBlock>
    </apex:form>
    
</apex:page>

Visualforce Page:-

User-added image

Here I am getting error:-
User-added image



Salesofrce MyDomain:-User-added image


When i tired to regester a my custom domain there also giving error:-
When i copy my custom domain and hit enter showing popup "must be a top level domain"

My problem is why google last shreenshot i am getting eorror must be a top level domain?
i know it is because my custom domain "testmycompany-dev-ed.my.salesforce.com" is a sub domain.
but please some one help me how to resolve this?

I have much eagerness to learn integration help me some one.
Challenge Not yet complete... here's what's wrong: 
The runWarehouseEquipmentSync method does not appear to have run successfully. Could not find a successfully completed @future job for this method. Make sure that you run this method at least one before attempting this challenge. Since this method is annotated with the @future method, you may want to wait for a few seconds to ensure that it has processed successfully.

here is my code

public with sharing class WarehouseCalloutService {
    
    private static final String WAREHOUSE_URL = 'https://th-superbadge-apex.herokuapp.com/equipment';
    @future(callout=true)
    // complete this method to make the callout (using @future) to the
    // REST endpoint and update equipment on hand.
    public static void runWarehouseEquipmentSync(){
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint(WAREHOUSE_URL);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        // If the request is successful, parse the JSON response.
        String ret = '';
        if (response.getStatusCode() == 200) {
            // Deserialize the JSON string into collections of primitive data types.
            List<Object> results = (List<Object>) JSON.deserializeUntyped(response.getBody());
            
            List<Product2> LstProduct = new List<Product2>();
            for(Object obj : results)
            { 
                Map<String, Object> mapobj = (Map<String, Object>)obj;
                Product2 product = new Product2();
                           
                Integer maintenanceperiod = (Integer)mapobj.get('maintenanceperiod');               
                Integer Lifespan = (Integer)mapobj.get('lifespan');
                Integer Cost = (Integer)mapobj.get('cost');
                Boolean replacement = (Boolean)mapobj.get('replacement');
                Integer quantity = ((Integer)mapobj.get('qIntegerntity'));
                product.Name  = (String)mapobj.get('name'); 
                product.Maintenance_Cycle__c = Integer.valueof(maintenanceperiod);
                product.Cost__c = Cost;
                product.Current_Inventory__c = quantity;
                product.Lifespan_Months__c = Lifespan; 
                product.Replacement_Part__c = replacement;
                product.Warehouse_SKU__c = (String) mapobj.get('sku');
                product.ProductCode = (String)mapobj.get('_id');       
                LstProduct.add(product);
            }
            
            System.debug(LstProduct);
             upsert LstProduct Warehouse_SKU__c;
        
        }
        
       
    }
}
Hi,
I am trying get owner name of an account like we see in UI using soql, which i will pass to rest service. I understand that there is releation between Account and User. i am trying to the following query but i am getting errors.
select+name,user.name+from+account
message: select name,user.name from account ^ ERROR at Row:1:Column:13 Didn't understand relationship 'user' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
errorCode: INVALID_FIELD
Can some one provide how to get this?