• gfdj gfdhg
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Help me Create a Trigger for CheckBox to clone Opportunity and OpportunityLineItem
//This is what i have coded please help resolve this
trigger CloneParentOpportunityTrigger on Opportunity (After insert,After update) 
{
    List<Opportunity> oppsToUpdate = new List<Opportunity>();
    Map<Id,Opportunity> OldOppId = new Map<Id,Opportunity>();
    Opportunity newopp = new Opportunity(); 
    if(Trigger.IsAfter)
    {
        if(Trigger.IsInsert || Trigger.IsUpdate)
        {
            if(newopp.Clone_Opportunity__c)
            {
                for(Opportunity opp : Trigger.new)
                { 
                    //opportunity list item
                    newopp.Name = opp.Name;
                    newopp.AccountId = opp.AccountId;
                    newopp.Product_Type__c = opp.Product_Type__c;
                    newopp.CloseDate = opp.CloseDate;
                    newopp.StageName = opp.StageName;
                    newopp.Payment_Frequency__c = opp.Payment_Frequency__c;
                    newopp.Most_Recent_Invoice_Date__c  = opp.Most_Recent_Invoice_Date__c;
                    newopp.Billing_Start_Date__c = opp.Billing_Start_Date__c;
                    newopp.Parent_Opportunity__c = opp.Id;
                    oppsToUpdate.add(newopp);
                    OldOppId.put(opp.id,opp);
                }
                
                insert oppsToUpdate;
                
                Map<Id,Opportunity> NewOppId = new Map<Id,Opportunity>();
                for(Opportunity opp1 : oppsToUpdate)
                {
                    NewOppId.put(opp1.Id, opp1);
                }
                
                List<OpportunityLineItem> oppitemList = new List<OpportunityLineItem>([SELECT Id, Product2Id, Quantity, UnitPrice, OpportunityId FROM OpportunityLineItem Where OpportunityId IN : OldOppId.keyset()]);
                for(OpportunityLineItem oppitem : oppitemList)
                {
                    OpportunityLineItem oli = new OpportunityLineitem();
                    oli.OpportunityId = NewOppId.get(oppitem.OpportunityId).Id;
                    oli.Product2Id = oppitem.Product2Id;
                    oli.Quantity = oppitem.Quantity;
                    oli.UnitPrice = oppitem.UnitPrice;
                    oppitemlist.add(oli);
                }
                insert oppitemList;
            }
        }   
    }
}
Problem
A nested RelayState using IDP initiated login doesn't work as expected. For example, we have one IDP (Salesforce Org IDP) and one SP (Marketing Cloud). 

IDP initiated deep link: https://testA.salesforce.com/idp/login?app=0sp5e0000004ABC&RelayState=https://mctest-m.login.exacttarget.com/secure/?service=https://mc.exacttarget.com/cloud/#app/Journey%20Builder

The above link which is essentially <IDP Initiated URL>+<SP Deeplink>, works. When a user that is logged into SF, clicks on the above link, they're logged into MC, and land on the Journey Builder page.

However when we want to navigate from a "parent" Sales Org that is using the 'Salesforce Org IDP' as a SP, the deep link doesn't work. It is as if the nested RelayState isn't being honored or it is just something that isn't being parsed correctly.

Nested IDP initiated deep link: https://parent.my.salesforce.com/idp/login?app=0sp5f0000008DEF&RelayState=https://testA.salesforce.com/idp/login?app=0sp5e0000004ABC&RelayState=https://mctest-m.login.exacttarget.com/secure/?service=https://mc.exacttarget.com/cloud/#app/Journey%20Builder

The above link takes the user to to Marketing Cloud home page, and not the Journey Builder.

Anyone ever run into any similar issues? Or any ideas. This isn't documented very well and so I've tried http encoding the nested url and a few other ways of passing the nested deep link without any luck.

Background
We use Salesforce and Marketing Cloud, and hvae configured MC to use SF's IDP for federated access. This works well but there is an additional requirement for MC to be able to setup trust with more than one IDP. This currently isn't possible to do with MC.

So we are using an intermediary Sales Org, purely as an IDP and MC as the SP. We then also use that intermidary Sales Org as the SP, by setting up trust with multiple Sales Orgs IDPs. This allows us to essentially have Many to One federation between Many Sales Orgs and a single Marketing Cloud account.

 
I have 2 objects (Account and case), where Case record will be created from an external source which passes account number as a input, Based on the account number I need to capture Account ID and assocciate the record. Can you please suggest how to go forward for this requirement?

Is there a posibility to attach image files to case form using mobile sdk?

https://developer.salesforce.com/docs/atlas.en-us.noversion.service_sdk_android.meta/service_sdk_android/android_cases_basic_setup.htm#android_cases_basic_setup