• Siddhant Indra
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 6
    Replies
When user is logged in community(Partner Community) and trying to insert FeedItem object getting error "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY"
When user is logged in community(Partner Community) and trying to insert FeedItem object getting error "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY"
Hii 


I want to restrict user to prevent duplicate email ids.When I am entering email id like abc@gmail.com which is already present in database of product.
.

trigger trgr on Product__c (before insert)  {

//Take a List & Map

list<string> emailAddresses= new list<string>();
map<string,id> existingEmails= new map<string,id>();


//For all product that are being inserted
for(Product__c ptc: trigger.new) {

//If the Product have a n Email ID Field value then add that into the Email Address List.
if(ptc.Dealer_Email_id__c!=null) {
  emailAddresses.add(ptc.Dealer_Email_id__c);
}
}

//Extract all the products in a list which have the Delar Email in the above list.
list<Product__c> pclst = new list<Product__c> ([select id,Dealer_Email_id__c from Product__c where Dealer_Email_id__c IN: emailAddresses ]);


// And for all those newly inserted products . insert them in a map to check if the email is existed in the repository or not , if there is match then give error Duplicate not allowd.
for(Product__c pt: trigger.new) {
existingEmails.put(pt.Dealer_Email_id__c,pt.id);
}

for(Product__c ptc: trigger.new)
{
if(existingEmails.get(ptc.Dealer_Email_id__c)!=null)
{
ptc.addError('Duplicates not allowed');

}

}


}

System.ListException: List index out of bounds: 0

Error is in expression '{!send}' in component <apex:commandButton> in page emailprocessingauto


    Messaging.singleEmailMessage email = new Messaging.singleEmailMessage();
    EmailTemplate Templates = [Select Id, Name, IsActive, Folder.Name,subject
                               From EmailTemplate  where Folder.Name ='DRM Email Templates' and id = :emailtemplateid];
   
    email.setToAddresses( toAddresses );

email.setTemplateID(Templates.Id);
email.settargetObjectId(contactList[0].Id);

 Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.singleEmailMessage[] {email});
return null;

 

 

please tell me how to resolve it .

Hi Friends,

 

I have a requirement to query on the standard object "Opportunity_Product".I don't know the object name to query.

 

Please help me.

 

Thanks,

 

Vijay

The system is throwing this error:FATAL_ERROR System.QueryException: IN operator must be used with an iterable expression.

 

The Query string is: 

string findTestPOs = 'SELECT id, name,Finalized__c,PO_Notes__c,Status__c, Ship_to_location__c, Expedite__c, PO_Date__c, Total_Price__c,Category__c,SFDC_Purchase_Order__c.ownerID FROM SFDC_Purchase_Order__c WHERE id in :MyPOIdSet';
The lines throwing the error are:
List<SFDC_Purchase_Order__c>myNewPOs = new List<SFDC_Purchase_Order__c>();
myNewPOs = database.query(FindTestPOs);

 

I have 2 questions:

What can I do to fix this error?

How can a Set not be iterable?

 

This reallly has me puzzled.  This is keeping my Test  code from running to completion.

I really appreciate any insight anyone has. 

 

Thank you very much.

Kathybb

Hi

 

I am trying to query my endpoint from custom setting in my RESTFULL call.

I created a object and a customfield in custom setting and made it public.

I gave my endpoint in that customfield(asdefaultvalue).

In my apex class Icreated a list and trying to query that field from that object.

But Iam getting nullvalue. Please help if I am missing something.