• Robert Jeffress 7
  • NEWBIE
  • 10 Points
  • Member since 2017


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 0
    Replies
In Report Types we can setup Accounts with Territories with Users.  I cannot find the proper objects to do the same in SOQL.  I want the Account with its Territories and the Users in those Territories.  If Reports can do it there shouldn't there be a SOQL solution as well. Report Type
I have a daily integration job, using Jitterbit Cloud Data Loader (the free version), that creates or updates products from an external system using a custom field set as External ID.  When a product is created, It must be associated or related to the standard Pricebook using PricebookEntry object. SF doesn't seem to do that automatically; I assume that is why one Pricebook is set as the Standard (IsStandard = true).  Looks like I need to do a second job to query Products not currently related to the standard price book and create an entry in PricebookEntry object for the missing ones.   In Jitterbit, I cannot use SF as the Source and the Target on the same job.  Using a Trigger on Product2 seems a little over the top for this.  I am sure others are integrating products and have solutions to share.  What is the best solution for doing this?  (I swear I so something like this on the certification exam)
I have a few calls to debug() in my apex code.  When users report an issue, can I access the debug logs for that occurrence or must I setup Debug for the user and have him/her repeat the process?  If I must setup Debug for the user, then way is there any concern with having debug() calls in Apex if it doesn't capture anything in the logs UNTIL we setup Debug for a user?

The WebServiceCallout.invoke method is not documented in any Salesforce publications.  I asked tech support and they don't have any docs either in their internal knowledge base.  They said it is part of the wsdlToApex tool and not documented.  They pointed me to an external forum site where someone has posted some details.  (Sad that I have to go to non-salesforce forum site to get this.)

 

If anyone else is looking for this info, here is the link:

http://stackoverflow.com/questions/4392616/what-are-the-parameters-for-the-salesforce-webservicecallout-invoke-method

 

And here are the details from the post.  I have not verified any of the text or code, use at your own risk.

 

Object servicePort - A class with the following variables:
  String enpoint_x: containing the service endpoint (not sure if necessary)
  Map<String,String> inputHttpHeaders_x: custom httpHeaders
  Map<String,String> outputHttpHeaders_x: I think this is the httpHeaders that were returned
  String clientCertName_x: Used in configuring an SSL cert?
  String clientCert_x: Used in configuring an SSL cert?
  String clientCertPassword: Used in configuring an SSL cert?
  Integer timeout_x: How long (in milliseconds?) to wait for the response
  String[] ns_map_type_info: The first String is the namespace of the service schema, the second is the name of the object that contains the Apex classes defining the schema objects
Object request_x - The Apex object that will form the XML schema object
Map<String, Object> response_map_x - Object is the object that the result is to be unserialized into. String is the name of Object variable.
String[] {
  endpoint - The service endpoint
  soapAction - If the service call requires a soapAction, put it here. Otherwise leave blank.
  methodSchema - Schema for the request object
  method - Name of the request method
  responseSchema Schema for the response
  responseClass The Apex class that the response will be unserialized into
}

 

In addition, Soap headers can be inserted by creating an object in the servicePort class as well as a String with the same variable name+"_hns" that specifies the namespace for that object:

public SoapSecurity Security;
private String Security_hns = "Security=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";

 

The apex XML Schema objects should contain variables for each child element (or attribute). Arrays whose variable names match certain patterns define how the object variables are used in the xml.

 

Given the following example XML: 

<foo a="b"><bar>baz</bar></foo>

 

The Apex classes would be something like this:

public class MyService {
   public class bar {
      public String bar;
      private String[] bar_type_info = new String[] {'bar','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
      private String[] apex_schema_type_info = new String[] {'http://schema.myservice.com', 'false', 'false'};
      private String[] field_order_type_info = new String[] {'bar'};
   }

   public class foo {
      public MyService.bar bar;
      public String a;
      private String[] bar_type_info = new String[] {'bar','http://schema.myservice.com','bar','0','1','true'};
      private String[] a_att_info = new String[] {'a'};
      private String apex_schema_type_info = new String[] {'http://schema.myservice.com','false','false'};
      private String[] field_order_type_info = new String[] {'bar'};
   }
}

 Please 

 

 

 

Here's a (brief) breakdown of these objects:

If the variable represents another XML element or a text node, then there needs to be a matching _type_info String[] e.g. bar_type_info. The elements of this array are: 1. XML element name 2. Schema 3. XML type 4. minOccurs 5. maxOccurs (set to '-1' for unbounded) 6. isNillable

If the variable represents an attribute, then there must be a matching _att_info String[] e.g. a_type_info. Thise simply contains the XML name of the attribute.

Note that if an class variable name is a reserved word, then _x is appended to it e.g. bar_x. This would affect the other variables names: bar_x_type_info. The Apex Developer's Guide explains their rules for names, but if you are manually creating it, I think you can give it whatever name you want--the arrays determine the XML element name...

I have not found a way to represent a simple XML type that also contains an attribute: e.g.

<foo bar="baz">bar</foo> 

The apex_schema_type_info array specifies information about the XML element represented by the class: 1. Schema 2. 'true' if elementFormDefault="qualified" 3. 'true' if attributeFormDefault="qualified"

I'm still rather fuzzy on what 2 and 3 actually do, but it seems to affect how child elements (and attributes) inherit the parent namespace (whether it's implied or must be specified in the resulting XML).

field_order_type_info simply specifies the order of the child elements.