• Ramani Sreedharala
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 4
    Replies
I have created one list view. It should be available only for admins.
But assigning list view I can see me or public or public group.
In Public groups I cant create any group for profile wise.
Is there any other alternative? Please suggest.
There is a look up relationship between opportunity and account, account and contact.
If I update opportunity, then flow should be triggered.
Based on the opportunity associated account's contact information should be come.
In the Record triggered flow, I can get account information from opportunity, but not contact information.
Can we get contact information from opportunity object when we have two layered relationship between them?
In flows can we achieve this?
I tried to download Email-to-Case agent.

But got 404 error. Followed the link which Salesforce provided.

Please suggest.
Hi,
As per business requirement, I may receive files in pdf, jpg, ppt, excel, png. I need to convert those in Word format. Can I achieve this in by writing apex? Please suggest.
I have writtern below code for after insert. no errors found and not executed.

trigger AccOpp on Account (After insert) {

List<Opportunity> op=new List<Opportunity>();
for(Account acc:trigger.new)
{
if(acc.AnnualRevenue>50 && acc.Industry=='Energy')
{
Opportunity O=new Opportunity(Accountid=acc.id,Name=acc.Name,StageName='Prospecting',CloseDate=date.today()+30);
op.add(O);
}
}
insert op;

}
Hi,

Please help me.

I am facing below error while trying to complete advanced apex specialist super badge step 2.

Challenge Not yet complete... here's what's wrong:
Ensure that the Quantity Ordered field on the Product object is correctly calculated when an Order is Activated.

--------
orderTrigger

/**
 * @name orderTrigger
 * @description
**/
trigger orderTrigger on Order(after update) {
    try{
        if(Trigger.isUpdate && Trigger.New != null){
            OrderHelper.AfterUpdate(Trigger.New,Trigger.old);
        }
    }catch(Exception e){
        System.debug('Exception in trigger -- '+e.getMessage());
    }
}
-------------------
OrderHelper

public class OrderHelper {
    
    /**
* @name AfterUpdate
* @description 
* @param List<Order> newList
* @param List<Order> oldList
* @return void
**/
    public static void AfterUpdate(List<Order> newList, List<Order> oldList){
        Set<Id> orderIds = new Set<Id>();
        for ( Integer i=0; i<newList.size(); i++ ){
            if (newList[i].Status == Constants.ACTIVATED_ORDER_STATUS && newList[i].ActivatedDate != null && oldList[i].Status == Constants.DRAFT_ORDER_STATUS ){
                orderIds.add(newList[i].Id);
            }
        }
        RollUpOrderItems(orderIds);
    }
    
    /**
* @name RollUpOrderItems
* @description Given a set of Activated Order ids, query the child Order Items and related Products to calculate Inventory levels
* @param Set<Id> activatedOrderIds
* @return void
**/
    public static void RollUpOrderItems(Set<Id> activatedOrderIds){
        //ToDo: Declare a Map named "productMap" of Ids to Product2 records
        Map<Id, Product2> productMap = new Map<Id, Product2>();
        Set<Id> productIds = new Set<Id>();
        
        //ToDo: Loop through a query of OrderItems related to the activatedOrderIds
        for ( OrderItem oi : [SELECT Id, Product2Id, Product2.Quantity_Ordered__c, Quantity FROM OrderItem WHERE OrderId IN :activatedOrderIds]){
            productIds.add(oi.Product2Id);
        }
        
        //ToDo: Populate the map with the Id of the related Product2 as the key and Product2 record as the value
        productMap = new Map<Id, Product2>([Select Id, Quantity_Ordered__c FROM Product2 WHERE Id IN :productIds]);
        
        //ToDo: Loop through a query that aggregates the OrderItems related to the Products in the ProductMap keyset
    for(AggregateResult ar : [SELECT Product2Id, SUM(Quantity) activatedQuantity FROM OrderItem
         WHERE Product2Id IN :productMap.keySet() GROUP BY Product2Id]){
              productMap.get((String)ar.get('Product2Id')).Quantity_Ordered__c = Integer.valueOf(ar.get('activatedQuantity'));
        }
        //ToDo: Perform an update on the records in the productMap
        if(productMap != null && productMap.size() > 0){
            update productMap.values();
        }
    }
    
}

--------------------
I got below error while trying to install package for Aura components Specialist super badge challenge.
Could some one please help me.

User-added image
Hi,

I am trying to do trialhead Lightning platform api basics > Use SOAP api 
I logged in succesfully, but trying to create account via SOAP api, got error.

My request in SOAP api

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">
   <soapenv:Header>
     
         
      <urn:SessionHeader>
         <urn:sessionId>00D28000001PJ51!AREAQGVMdkru90jT8tISYYEoNMpiFQXFWEFI.nqbaOy_gGRIxX4qbw9QJEd2K6vLmuqnWQ5vVGfRxwPjvgmxSs0vNzky0GGp</urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:create>
         <!--Zero or more repetitions:-->
         <urn:sObjects xsi:type="urn1:Account" xmlns:xsi="https://login.salesforce.com/services/Soap/c/50.0/0DF0I0000000mmX">
           <Name>Bluebeards Grog House</Name>
           <description>It is better than Blackbeards.</description>
         </urn:sObjects>
      </urn:create>
   </soapenv:Body>
</soapenv:Envelope>


Response is 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>UNKNOWN_EXCEPTION</faultcode>
         <faultstring>UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService</faultstring>
         <detail>
            <sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault">
               <sf:exceptionCode>UNKNOWN_EXCEPTION</sf:exceptionCode>
               <sf:exceptionMessage>Destination URL not reset. The URL returned from login must be set in the SforceService</sf:exceptionMessage>
            </sf:UnexpectedErrorFault>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>


I understood that URL which i have sent, that is wrong. Please suggest correct one.
Hi,

I am trying to do trialhead Lightning platform api basics > Use SOAP api 
I logged in succesfully, but trying to create account via SOAP api, got error.

My request in SOAP api

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">
   <soapenv:Header>
     
         
      <urn:SessionHeader>
         <urn:sessionId>00D28000001PJ51!AREAQGVMdkru90jT8tISYYEoNMpiFQXFWEFI.nqbaOy_gGRIxX4qbw9QJEd2K6vLmuqnWQ5vVGfRxwPjvgmxSs0vNzky0GGp</urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:create>
         <!--Zero or more repetitions:-->
         <urn:sObjects xsi:type="urn1:Account" xmlns:xsi="https://login.salesforce.com/services/Soap/c/50.0/0DF0I0000000mmX">
           <Name>Bluebeards Grog House</Name>
           <description>It is better than Blackbeards.</description>
         </urn:sObjects>
      </urn:create>
   </soapenv:Body>
</soapenv:Envelope>


Response is 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>UNKNOWN_EXCEPTION</faultcode>
         <faultstring>UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService</faultstring>
         <detail>
            <sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault">
               <sf:exceptionCode>UNKNOWN_EXCEPTION</sf:exceptionCode>
               <sf:exceptionMessage>Destination URL not reset. The URL returned from login must be set in the SforceService</sf:exceptionMessage>
            </sf:UnexpectedErrorFault>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>


I understood that URL which i have sent, that is wrong. Please suggest correct one.
I tried to download Email-to-Case agent.

But got 404 error. Followed the link which Salesforce provided.

Please suggest.
Hi,
As per business requirement, I may receive files in pdf, jpg, ppt, excel, png. I need to convert those in Word format. Can I achieve this in by writing apex? Please suggest.
Hi,

Please help me.

I am facing below error while trying to complete advanced apex specialist super badge step 2.

Challenge Not yet complete... here's what's wrong:
Ensure that the Quantity Ordered field on the Product object is correctly calculated when an Order is Activated.

--------
orderTrigger

/**
 * @name orderTrigger
 * @description
**/
trigger orderTrigger on Order(after update) {
    try{
        if(Trigger.isUpdate && Trigger.New != null){
            OrderHelper.AfterUpdate(Trigger.New,Trigger.old);
        }
    }catch(Exception e){
        System.debug('Exception in trigger -- '+e.getMessage());
    }
}
-------------------
OrderHelper

public class OrderHelper {
    
    /**
* @name AfterUpdate
* @description 
* @param List<Order> newList
* @param List<Order> oldList
* @return void
**/
    public static void AfterUpdate(List<Order> newList, List<Order> oldList){
        Set<Id> orderIds = new Set<Id>();
        for ( Integer i=0; i<newList.size(); i++ ){
            if (newList[i].Status == Constants.ACTIVATED_ORDER_STATUS && newList[i].ActivatedDate != null && oldList[i].Status == Constants.DRAFT_ORDER_STATUS ){
                orderIds.add(newList[i].Id);
            }
        }
        RollUpOrderItems(orderIds);
    }
    
    /**
* @name RollUpOrderItems
* @description Given a set of Activated Order ids, query the child Order Items and related Products to calculate Inventory levels
* @param Set<Id> activatedOrderIds
* @return void
**/
    public static void RollUpOrderItems(Set<Id> activatedOrderIds){
        //ToDo: Declare a Map named "productMap" of Ids to Product2 records
        Map<Id, Product2> productMap = new Map<Id, Product2>();
        Set<Id> productIds = new Set<Id>();
        
        //ToDo: Loop through a query of OrderItems related to the activatedOrderIds
        for ( OrderItem oi : [SELECT Id, Product2Id, Product2.Quantity_Ordered__c, Quantity FROM OrderItem WHERE OrderId IN :activatedOrderIds]){
            productIds.add(oi.Product2Id);
        }
        
        //ToDo: Populate the map with the Id of the related Product2 as the key and Product2 record as the value
        productMap = new Map<Id, Product2>([Select Id, Quantity_Ordered__c FROM Product2 WHERE Id IN :productIds]);
        
        //ToDo: Loop through a query that aggregates the OrderItems related to the Products in the ProductMap keyset
    for(AggregateResult ar : [SELECT Product2Id, SUM(Quantity) activatedQuantity FROM OrderItem
         WHERE Product2Id IN :productMap.keySet() GROUP BY Product2Id]){
              productMap.get((String)ar.get('Product2Id')).Quantity_Ordered__c = Integer.valueOf(ar.get('activatedQuantity'));
        }
        //ToDo: Perform an update on the records in the productMap
        if(productMap != null && productMap.size() > 0){
            update productMap.values();
        }
    }
    
}

--------------------