• RODRIGO DOMINGUES
  • NEWBIE
  • 0 Points
  • Member since 2017


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 0
    Questions
  • 7
    Replies
The call for service field description in the requirement is way different than what trailhead is actually validating.

User-added image
I am trying to share a chatter document(Has AllUsers Visibility) via apex with a partner commuity user using the ContentDocumentLink object but, I am continuously thrown an error. I need to allow the community user to upload revisions of documents they did not create. Any ideas on how to do this? Code and error below:

Record I attempt to insert:
insert new ContentDocumentLink(
    ContentDocumentId = '069XXXXXXXXX',
    LinkedEntityId  = [Portal User Id],
    ShareType = 'C'
);

Error Received: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.: [LinkedEntityId]
  • August 11, 2016
  • Like
  • 0
Hi, I am having trouble with the "Attributes and Expressions" module from trailhead.

Here is the challenge:
Create a Lightning Component to display a single item for your packing list.
  • Create a component called campingListItem that displays the name (ui:outputText) and the three custom fields using the appropriate output components.
  • Add an attribute named 'item' for type Camping_Item__c.
I created an component named campingListItem and this is the code:
<aura:component >
    <aura:attribute name="item" type="<my_domain>__Camping_Item__c"/>
    
    <ui:outputText value="{!v.item.Name}"/>
    <ui:outputCheckbox value="{!v.item.<my_domain>__Packed__c}"/>
    <ui:outputCurrency  value="{!v.item.<my_domain>__Price__c}"/>
    <ui:outputNumber value="{!v.item.<my_domain>__Quantity__c}"/>
</aura:component>

The error that I am getting is: "Challenge Not yet complete... here's what's wrong: 
The packingListItem Lightning Component's attribute tag doesn't exist or its attributes are not set correctly."

With this, I tried to create another component, with the name "packingListItem", but It didn't work.

Can anyone help me?

Thanks,
Hi All.

I am getting the following error on my trigger:
ERROR: AddOnTrigger: execution of AfterInsertcaused by: System.StringException: Invalid id: 9 External entry point
Any thoughts? Code is below. You can see my Objects are Contact(Standard), AddOn(Custom), Dev_AddOn(CustomJunction)

I am trying to write a trigger that will create the junction records from the Contact object and the AddOn object after the AddOn objects are created and edited. There are custom ID fields that I created as well so I will not be using the 

I am not a developer by trade and I got this far with the code because of the help from someone from the Community. Would appreciate any help in pointing me in the right direction. At this point, based on the error Im getting, I am not sure what next investigatory steps to take to rectify the code/problem.

Thank you very much for your time.
 
trigger AddOnTrigger on AddOn__c (after insert, after edit) {
    List<Dev_AddOn__c> aOBList = new List<Dev_AddOn__c>();
    
    
    Set<String> accIdSet = new Set<String>();
    
    for(AddOn__c obj: Trigger.new) {
        if(obj.ContactID_Values__c != null && obj.ContactID_Values__c != '') {
            List<String> accIdList = obj.ContactID_Values__c.split(',');
            accIdSet.addAll(accIdList);
        }
    }
    
    if(!accIdSet.isEmpty()) {
        Map<Id, Contact> accMap = new Map<Id, Contact>([Select Id, Name from Contact where Id IN: accIdSet]);
        for(AddOn__c obj: Trigger.new) {
            if(obj.ContactID_Values__c != null && obj.ContactID_Values__c != '') {
                List<String> accIdList = obj.ContactID_Values__c.split(',');
                
                for(String accId: accIdList)  {
                    if(accMap.get(accId) != null) {
                        Contact acc = accMap.get(accId);
                        Dev_AddOn__c aOB = new Dev_AddOn__c();
                        aOB.Name = obj.Name+' '+acc.Name;
                        aOB.AddOn__c = obj.Id;
                        aOB.Contact__c = acc.Id; 
                        aOBList.add(aOB);
                    }
                }
            }
        }
        
        if(!aOBList.isEmpty()) {
            insert aOBList;
        }
    }
}



 

I'm getting this error: entity type cannot be inserted: Product on an upsert soap call.

 

I'm system admin and have full rights on the product2 object. Not sure why I would get this error. I have specified the required fields on the product2 object. And I could add a new product through the UI. 

 

Have you run this issue before?

I have several triggers on the opportunity object...before insert, before update and before insert, before update.  I need to add a new trigger that fires after the opportunity is updated:

 

trigger OpportuntityAfterUpdate on Opportunity (after update) { List<Opportunity> opps = [Select Id, Transaction_ID__c, Name, StageName, Product_Line_ProDev_Category__c, Opportunity.Account.BillingStreet, Opportunity.Account.BillingCity, Opportunity.Account.BillingState, Opportunity.Account.BillingPostalCode From Opportunity WHERE Id in :Trigger.new]; Set<Id> oppyIds = new Set<Id>(); for (Opportunity o : opps) { oppyIds.add(o.Id); } OpportunityLineItem oli = [Select Site__c From OpportunityLineItem WHERE OpportunityId in : oppyIds LIMIT 1]; if (oli.Site__c <> null) { Account acct = [Select a.Name, a.Id From Account a WHERE a.Id = : oli.Site__c]; for (Opportunity oppy: opps) { if (oppy.StageName == 'Closed Won' && oppy.Product_Line_ProDev_Category__c > 0) { // Create a new single email message object // that will send out a single email to the addresses in the To, CC & BCC list. Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); // Strings to hold the email addresses to which you are sending the email. String[] toAddresses = new String[] {'test@test.com'}; String[] ccAddresses = new String[] {'test@test.com.com',}; // Assign the addresses for the To and CC lists to the mail object. mail.setToAddresses(toAddresses); mail.setCcAddresses(ccAddresses); // Specify the address used when the recipients reply to the email. mail.setReplyTo('test@test.com'); // Specify the name used as the display name. mail.setSenderDisplayName('Salesforce Support'); // Specify the subject line for your email address. mail.setSubject('A new Professional Development order has been placed!'); // Set to True if you want to BCC yourself on the email. mail.setBccSender(false); // Optionally append the salesforce.com email signature to the email. // The email address of the user executing the Apex Code will be used. mail.setUseSignature(false); // Specify the text content of the email. mail.setPlainTextBody('Opportunity Name: ' + oppy.Name + '/n' + 'Transaction ID: ' + oppy.Transaction_ID__c + '/n' + 'Account Name: ' + acct.Name + '/n' + 'Billing Address: ' + oppy.Account.BillingStreet + '/n' + 'Billing City: ' + oppy.Account.BillingCity + '/n' + 'Billing State: ' + oppy.Account.BillingState + '/n' + 'Billing Zip: ' + oppy.Account.BillingPostalCode + '/n'); mail.setHtmlBody('<p>Opportunity Name: ' + oppy.Name + '</p>' + '<p>Transaction ID: ' + oppy.Transaction_ID__c + '</p>' + '<p>Account Name: <a href=https://cs2.salesforce.com/' + acct.Id + '>' + acct.Name + '</a></p>' + '<p><hr /></p>' + '<p>Billing Address: ' + oppy.Account.BillingStreet + '</p>' + '<p>Billing State: ' + oppy.Account.BillingState + '</p>' + '<p>Billing Zip: ' + oppy.Account.BillingPostalCode + '</p>'); // Send the email you have created. Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); } } } }

 

The above trigger works by itself, but it is conflicting with the other triggers on the opportunity object.  It is causing the error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY error when a new opportunity is created. 

 

Here are the three existing triggers on the opportunity that are conflicting with the after update trigger:

 

trigger OpportunityBeforeInsert on Opportunity (before insert) { // calculate the "active *" fields on this opportunity's accounts for (Opportunity oppy : Trigger.new) { AccountActivityCalculator.updateAccount(oppy.AccountId); } } trigger OpportunityBeforeInsertBeforeUpdate on Opportunity (before insert, before update) { // grab owner's ID and push it into Commission_Salesperson__c (since Owner fields are not available in formula lookups) for (Opportunity opp : Trigger.new) { if(opp.Commission_Salesperson__c == null) { opp.Commission_Salesperson__c = opp.OwnerId; } } } trigger OpportunityAfterInsert on Opportunity (after insert) { List<Opportunity> opps = [select Id, Invoice_Preference__c, Account.Invoice_Preference_Value__c, Account.Sales_Area__c, Account.FOB_Destination__c, Account.District_Active_Sites__c, Account.District_Active_Subscriptions__c from Opportunity where Id in :Trigger.new]; for (Opportunity oppy: opps) { // copy over fields from account that should be historically accurate (i.e. can't be done via formulas) oppy.Invoice_Preference__c = oppy.Account.Invoice_Preference_Value__c; if (oppy.Payment_Terms__c == '') { // user is a salesperson, did not enter it; copy from Account oppy.Payment_Terms__c = oppy.Account.Payment_Terms__c; } oppy.FOB_Destination__c = oppy.Account.FOB_Destination__c; oppy.Sales_Area__c = oppy.Account.Sales_Area__c; oppy.Active_Sites__c = oppy.Account.District_Active_Sites__c; oppy.Active_Subscriptions__c = oppy.Account.District_Active_Subscriptions__c; } update opps; }

 

How can I get around this conflict and fire the after update trigger successfully?
Message Edited by Dman100 on 04-21-2009 09:51 AM

I need to get the object wise page layout names. is there any app exchange package or some other way we can find the page layout names object wise using schema class or any other method ?

 

Thank you in advance 

Hi,

I am trying to use values of formula fields to perform some logic in my before trigger. Would the formula fields be available for me in before trigger ?

Thanks
I have migrated Notes to Enhanced Notes (ContentNote) using SF data loader. Most of the records are migrated successfully, only in few of the records I am receiving following error:

Invalid sharing type "I"
I tried changing the ShareType to 'C' (Collaborator) but same error. Does it have something to do with security settings of the Parent (LinkedEntityId) record?

P.S. All the error records have ParentIds in Quote ('0Q0') or Email Template ('00X') objects.