• Sunny_Slp
  • NEWBIE
  • 55 Points
  • Member since 2011

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 17
    Replies

Hi Everyone,

 

I'm trying to retrieve  Partial_Control_Group__c records connected via junction object CSAP_CGLP_Junction__c to CRD__c

 

here is my query:

 

pcgList=[SELECT Id,Name,CSAP_Control_ID__c,CSAP_Plan_ID__c FROM Partial_Control_Group__c WHERE Id IN (SELECT Partial_Control_Group__c FROM CSAP_CGLP_Junction__c WHERE CRD__c=:sourceCrdId) ORDER BY Name]; 

/*build string*/ 

for(Partial_Control_Group__c pcg:pcgList){
      s=s+pcg.get('CSAP_Control_ID__c')+pcg.get('CSAP_Plan_ID__c')+',';
    } 

 

 is it safe (in terms of governor limits) to use inner query in this case?  there are 2000-3000 records for each CRD__c  and I'm worried about hitting any governor limits...would you call this safe way to do it or is there another even better way ?

 

Thank you,

SunnySlp

Hi everyone, I was trying to add elements to a list and for some reason I cannot understand, the code replaces all the elements with the most recent one.

 

GMFXmlWriter_ValueOnly handle=new GMFXmlWriter_ValueOnly();
  Map<String,String> parentMap=new Map<String,String>();
  Map<String,String> child=new Map<String,String>();
  List<Map<String,String>> childMap=new List<Map<String,String>>();
  
  parentMap.put('sampleParent_name1','sampleParent_value1');
  parentMap.put('sampleParent_name2','sampleParent_value2');
  
  child.put('samplechild1_elem1','samplechild1_value1');
  child.put('samplechild1_elem2','samplechild1_value2');
  childMap.add(child);

 child.clear();
 child.put('samplechild2_elem1','samplechild2_value1');
 child.put('samplechild2_elem2','samplechild2_value2');
 childMap.add(child);

 

After running the above code, childMap has 

 

 USER_DEBUG [24]|DEBUG|({samplechild2_elem1=samplechild2_value1, samplechild2_elem2=samplechild2_value2}, (already output))

 

basically, it has samplechild2 twice. I can't figure what I'm doing wrong. Any help will be greatly appreciated.

 

Thanks,

Sunny_Slp

 

I'm trying to create an XML document from a select set of fields of an object. I decided to use XmlStreamWriter class.

 

To write <fieldlabel1>fieldlabel1_value</fieldlabel1>

              <fieldlabel2>fieldlabel2_value</fieldlabel2> and so on

 

I made a List<string> fieldstoInclude that has all the fields to include in XML

 

              for(String s : fieldstoInclude){
                 w.writeStartElement(null,s,null);
                 //how to write value?
                 w.writeEndElement();
                }

My question here is, since WriteCharacter only takes Text and fields of an object can be of varying types, what is the best way to go ahead and do this?

 

I was thinking of making a map<string,string> with field labels as Map's keys and field values converted into strings as Map's value. There are hundereds of fields and I don't want to write code to convert each field manually. Is there a way to do this?

 

Any help will be greatly appreaciated.

 

Thank you,

Sunny_Slp

Hi Everyone, I have the following fields selected for outbound message

 

    • Id
    • Plan_Platform__c
    • Pricing_Schedule__c
    • Risk_Indicator__c
    • RxPlanDataExp__c
    • RxPlanData__c
    • Rx_PP_ID__c
    • State__c
    • TP_ID__c
    • but when I look at the generated WSDL, I see

 

 

 

<!--
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:tns="http://soap.sforce.com/2005/09/outbound" xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:ent="urn:enterprise.soap.sforce.com" xmlns:ens="urn:sobject.enterprise.soap.sforce.com"targetNamespace="http://soap.sforce.com/2005/09/outbound">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"targetNamespace="urn:enterprise.soap.sforce.com">
<!-- Our simple ID Type -->
<simpleType name="ID">
<restriction base="xsd:string">
<length value="18"/>
<pattern value="[a-zA-Z0-9]{18}"/>
</restriction>
</simpleType>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"targetNamespace="urn:sobject.enterprise.soap.sforce.com">
<import namespace="urn:enterprise.soap.sforce.com"/>
<!-- Base sObject (abstract) -->
<complexType name="sObject">
<sequence>
<element name="fieldsToNull" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
<element name="Id" type="ent:ID" nillable="true"/>
</sequence>
</complexType>
<complexType name="AggregateResult">
<complexContent>
<extension base="ens:sObject">
<sequence>
<any namespace="##targetNamespace" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="CRD__c">
<complexContent>
<extension base="ens:sObject">
<sequence>
<element name="Plan_Platform__c" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="Rx_PP_ID__c" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="State__c" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="TP_ID__c" nillable="true" minOccurs="0" type="xsd:string"/>
</sequence>
</extension>
</complexContent>
</complexType>

 

 

Fields such as RxPlanData,RxPlanDataExp,Rx_PP_ID,Risk_Indicator are absent? is there something wrong here?

 

Hi Everyone,

 

When returning ACK for an outbound message, what URL should I use? (is it enterprise URL?) 

 

also, should I include notification ID in ACK? I'm not sure how SFDC identifies which message I acknowledged. 

 

Thanks for any help,

 

Sunny_Slp

Hi Everyone,

 

How do I know if an outbound messag was successfully delivered (without checking with the external system)? does an empty "Outbound Messaging Statu" mean a success? The workflow rule is being triggered correctly.

 

I appreciate any help.

 

Thank you,

Sunny_Slp

Hey everyone,

 

We're trying to track 20+ fields on one custom object (Candidate__c), and since SFDC only allows for 20, I though of having a trigger on that custom object that gets triggered for insert,update. The plan was then to go ahead and

 

create a  Candidate_History record with parentId=Candiaterecord.Id, Field=Field22,NewValue=Trigger.new[0].Field22,OldValue=Trigger.old[0].Field22; and then insert it?

 

the webAPI document says History objects of custom objects support create(), I assumed it would mean we can create and insert the object?

 

Here is a scaled down example of what I'm trying to do, is this even possible? I'm getting some wierd DML exceptions with no error message to know what exactly happend.

 

trigger candidateAudit on Candidate__c (after insert, after update) {
      Candidate__c currentobject=Trigger.new[0];                                                                       Candidate__History historyrecord=new Candidate__History(parentId=currentobject.Id);
insert historyrecord;
}



Hi everyone,

 

I'm currently working on a project that integrates salesforce with an in-house system/external system. We will be sending around 500 fields of data(Approx) to this external system in realtime (depending on various conditions).

 

Our original design was to use "Outbound Message" , but the external system security team  is very particualr about authentication, they do not support IP flitering nor Mutual Authentication, which would have made things easy. Since, Outbound message can't be customized as a workaround there were proposals for using "Callouts" with username and password embedded in HTTP header. To summarize, a callout will be made with username and password embedded within the HTTP header ; all data (to be sent) will be included as callout's arguments(~500). The external system would then authenticate based on username password and would go on to processes included data/arguments.

 

 I would like to know, if it is advisable to use "Callouts" when trying to send large number fields? I'm having a hard time imagining a callout with ~500 arguments.

 

Any help will be greatly appreaciate.

 

Thanks,

Sunny_Slp

 

 

Hi Everyone,

 

The project I'm currently working on requires that whenever a new record (SLS , a custom object) is a created and after it gets approved by a manager a pdf version of the record should generated, a case object should be created and the pdf will be attached to that case object and will be sent over using salesforce2salesforce connection.

 

I have written the code to do this (pdfCreator class), but the problem is how do I call this class?

 

The pdf creation, case record creation and the attachmet should happen after the SLS record is approved (uses approval rules)  by a manager. So the event that should cause this class to run ( however indirect that may be) is the approval's final actions.

 

I can't use a trigger (After update on SLS by updating a dummy field on SLS ) to call pdfCreator as getContent() can't be called using triggers. Is there any other way that I can call this class (pdfCreator) that creates case object, generates pdf version of SLS and attaches it to case object and sends it over via sfdc2sfdc.

 

Thank you,

Sunny_Slp

Hi everyone,

 

I'm trying to integrate SFDC to an external system using outbound messages, The external system's security policy requires some sort of authentication. Is it possible to authenticate with an outbound message?

 

more specifically, can we include HTTP basic or Digest access authentication headers with an outbound message? or if there are other ways to authenticate an outbound message can someone please provide the details.

 

Any help will be greatly apperciated.

 

Thank you,

Sunny_Slp

Hi Everyone, I'm trying to understand how to expose Apex methods as webservices using webservice keyword.

 

Here is what I understood, after creating a web service method in an apex class, I generate the WSDL for that class and hand it over to the external application developer.

 

What I don't understand is, will the external developer be required to call login() method ? ( as we do in web API)

 

consider the following class:

 

global class MyWebService {
    webService static Id makeContact(String lastName, Account a) {
        Contact c = new Contact(lastName = 'Weissman', AccountId = a.Id);
        insert c;
        return c.id;
    }
}

 

how do we call MyWebService.makeContact method? do we have to use connection/binding ? ( as we do in web API)

 

Finally , can we use any of the web API calls (like retrieve() ) within the client (when it only has WSDL from this particular class) ?

 

Any help will be greatly appreciated.

 

Thank you,

 

Sunny_Slp

Hi All,

 

I want know in which tab is user in through VFP. My details scenario is as follows:

 

I have a Case Pgae Layout within which we have a visualforce page. This Case Layout can be accessed by Case tab and also through console. So my question is how can I know where is User present in Console tab or in Case tab. Any working example to achieve this would be highly appreciated.

 

Regards,

Lakshman

Hi everyone, I have a requirement where, whenever a new record (of a custom object) is created a PDF version of this record should be sent to an external server.

 

I thought of creating a visualforce page that generates the required PDF document and then write apex code to attach the PDF to another object ( created for this very purpose). Then use outbound message to send the object along with the attachment ( which now has the PDF document) to an external server but I realized outbound messaging cannot be used to send attachments of an object.

 

If generating and sending a PDF document cannot be based on a save event, is it possible  to send the PDF documents of records(created on that day) to an external service? (so, instead of sending everytime a new record is created; send it once a day)

 

Any help will be greatly appreciated.

 

Thank you,

 

Sunny Slp

Hi all,

I am trying to use apex class webService method in java. But it is giving following error


 

Exception in thread "main" AxisFault


Details are as following

Apex Class

 

 

global class WebServiceAccountPlan {
 
   
   global class Plan {
      webservice String name;
      webservice Integer planNumber;
      webservice Date planningPeriod;
      webservice Id planId;
   }
 
   webservice static Plan createAccountPlan(Plan vPlan) {
       
       Account acct = new Account();
       acct.Name = vPlan.name;
       acct.AccountNumber = String.valueOf(vPlan.planNumber);
       insert acct;
       vPlan.planId=acct.Id;
       return vPlan;
  }
   
}

 

 

 

Java Code:

 

 

public class trySendingEmail {

 

 public static void main(String[] args) throws Exception {

 login();         //general login code in method

 //sendEmail();

 WebServiceAccountPlanBindingStub wbind = new WebServiceAccountPlanBindingStub();

 Plan vPlan = new Plan();

 vPlan.setName( "Namita");

 vPlan.setPlanId("abcdNewPlan");

 vPlan.setPlanningPeriod(null);

 vPlan.setPlanNumber(1234);

 

// This line gives the error

 Plan endresult = wbind.createAccountPlan(vPlan);

 //System.out.println("----------------"+endresult);

 }

 

 

}

 

Can anybody please tell me where am i going wrong