• Juan David Uribe Ruiz
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Hi All,
I am badly stuck at a point where I need help from the Community.


I have visualforce email template with custom vf component. The email is send using apex code by a guest user. I get below error while whenever guest user tries to send email using a site page -

INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []

public static void sendSurveyNotification(list<Feedback_Survey__c> feedbacks) {
        //try {           
        	if(feedbacks!=null && feedbacks.size()> 0) {               
                //Fetching the email template
                Id emt_notify;
                Id emt_completed;
                list<EmailTemplate> emts = [Select Id, Name, DeveloperName From EmailTemplate where DeveloperName 
                                            IN ('C_SAT_Survey_Request_Notification','C_SAT_Survey_Completed_Notification') LIMIT 2];
                
                if(emts[0].DeveloperName == 'C_SAT_Survey_Request_Notification') {
                    emt_notify = emts[0].id;
                    emt_completed = emts[1].id;
                }
                else {
                    emt_notify = emts[1].id;
                    emt_completed = emts[0].id;
                }
                list<Messaging.SingleEmailMessage> messages = new list<Messaging.SingleEmailMessage>();
                
                for(Feedback_Survey__c fbk: feedbacks) {
                    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                   	if(fbk.C_SAT_Status__c == 'Initiated')
                    	mail.setTemplateId(emt_notify);
                    else
                        mail.setTemplateId(emt_completed);
                    
                    mail.setTargetObjectId(UserInfo.getUserId());
                    System.debug('Taget Object Id==>'+UserInfo.getUserId());
                    mail.setWhatId(fbk.Id);
                    System.debug('fbk id==>'+fbk.id);
                    mail.setTreatTargetObjectAsRecipient(false);
                    list<String> ccaddresses = new list<String>{(String)fbk.Transaction_Manager_Email__c, (String)fbk.Survey_Requester_Email__c};
                    mail.setCcAddresses(ccaddresses);
                    mail.setToAddresses(new list<String>{(String)fbk.Real_Estate_Manager_Email__c});
                    mail.setOrgWideEmailAddressId(system.label.Org_Wide_TM_Support);
                    System.debug('Org Wide Address==>'+system.label.Org_Wide_TM_Support);
                    mail.setSaveAsActivity(false);
                    messages.add(mail);
                }
                Messaging.sendEmail(messages);
            }
        /*}
        Catch(Exception e) {
            System.debug('Error ==>' +e.getMessage());
            System.debug('Line Number ==>' +e.getLineNumber());
            System.debug('Cause ==>'+e.getCause());
            System.debug('Cause ==>'+e.getStackTraceString());
        }*/
    }

Thanks in Advance...!!
Hi,
In SAP, I want to generate a proxy from a Salesforce wsdl file to consume a webservice but when i try to create the proxy from Tcode SE80 in SAP, I got following error:

Background
During proxy generation, an interface description in WSDL format is fetched from the Enterprise Services Builder or from another soource and interpreted. This WSDL document must
describe the whole interface correctly.
==> Display Query
==> Display WSDL Document

Diagnosis
In the WSDL document the object
 "DataCategory"
from the namespace
 "urn:enterprise.soap.sforce.com"
was defined.
However, this refers (directly or indirectly) to itself.

Recursion of this kind in type definitions is not supported.

System Response
Proxy generation is terminated.

Procedure
Avoid recursive type definitions.

As you see in some part of the Salesforce wsdl message, its exception structure consists of recursive type.

          <complexType name="DataCategory">
              <sequence>
                    <element name="childCategories" type="tns:DataCategory" minOccurs="0" maxOccurs="unbounded"/>
                    <element name="label"           type="xsd:string"/>
                    <element name="name"            type="xsd:string"/>
                </sequence>
            </complexType>


How can i handle this problem ? Is there any other syntax to replace the recursive type in Salesforce WSDL file?
Thanks.