• sdetweil
  • NEWBIE
  • 260 Points
  • Member since 2011

  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 118
    Replies

Hi.
I have a problem that I can't get around in my code. I have a small webservice that receives data from an outside source and uses that to construct a task and associate it with a contact or lead. the webservice has only one method called "logSingleEmail". This method takes a list of a custom class called DocumentLink as one of it's arguments.  Now all tests run normally and I am able to invoke this code successfully from Eclipse as anonymous code. The problem is that the WSDL doesn't list the attributes of the DocumentLink class, and my customer can't invoke the webservice as a result.
Hopefully this is just some small oversight on my behalf that someone can help me with. Included below are both the code from my webservice as well as the generated wsdl:

 

APEX CODE:

 

global class WS_LogCustomerEmail {
	
	static webservice CallResult logSingleEmail( String strCustomerEmail, String strIPadUdid, List<DocumentLink> documents ){
		//lookup lead/contact from strCustomerEmail
		
		Boolean bWasFound = false;
		Contact c = new Contact();
		Lead l = new Lead();
		try{
			l = [Select Id from Lead where Email =: strCustomerEmail limit 1];
		}
		catch( Exception e){
		
	
			try{
				c = [Select Id from Contact where Email =: strCustomerEmail limit 1];
				bWasFound = true;
			}
			catch( Exception ex){
				return new CallResult('Email not found');
			}
			/*if( c != null ) bWasFound = true;
			else return new CallResult('Customer email was not found in Salesforce');
			*/
		}
		
		
		//construct email body from list and strIPadUdid
		String emailBody = 'The following document links were sent via offline catalog:\n\n';
		for( DocumentLink link:documents){
			emailBody += link.strDocumentName + ' - ' + link.strDocumentUrl + '\n';
		}
		emailBody += '\n from user: ' + strIPadUdid;
		
		Task t = new Task();
		if( l.Id != null) t.WhoId = l.Id;
		else if( c.Id != null) t.WhoId = c.Id;
		else return new CallResult('Unknown customer Id');
		
		t.Description = emailBody;
		t.Subject = 'Documents from offline catalog';
		
		try{
			insert t;
		}
		catch ( Exception e){
			return new CallResult(e.getMessage());
		}
		
		return new CallResult('1');	
	}
	
	global class CallResult{
		public String strResult;
		public Callresult( String strIn ){ strResult = strIn; }	
	}
	
	global class DocumentLink{
		public String strDocumentName;
		public String strDocumentUrl;
		
	}
	
	static testMethod void coverCodeForService(){
		Lead l = new Lead();
		l.Email = 'ivargu@thisisjustfortestingpurposes.com';
		l.LastName = 'Gunnarsson';
		l.Company = 'MyCompany';
		insert l;
		
		DocumentLink dl = new DocumentLink();
		dl.strDocumentName = 'Name';
		dl.strDocumentUrl = 'http://www.mbl.is';
		List<DocumentLink> dlList = new List<DocumentLink>();
		dlList.add(dl);
		
		CallResult result = logSingleEmail( 'ivargu@thisisjustfortestingpurposes.com', '12345', dlList );
		
		
	}
}

   WSDL:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<!-- Web Services API : WS_LogCustomerEmail -->
<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://soap.sforce.com/schemas/class/WS_LogCustomerEmail" targetNamespace="http://soap.sforce.com/schemas/class/WS_LogCustomerEmail">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://soap.sforce.com/schemas/class/WS_LogCustomerEmail">
<xsd:element name="DebuggingInfo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="debugLog" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="ID">
<xsd:restriction base="xsd:string">
<xsd:length value="18"/>
<xsd:pattern value="[a-zA-Z0-9]{18}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LogCategory">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Db"/>
<xsd:enumeration value="Workflow"/>
<xsd:enumeration value="Validation"/>
<xsd:enumeration value="Callout"/>
<xsd:enumeration value="Apex_code"/>
<xsd:enumeration value="Apex_profiling"/>
<xsd:enumeration value="Visualforce"/>
<xsd:enumeration value="System"/>
<xsd:enumeration value="All"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LogCategoryLevel">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Internal"/>
<xsd:enumeration value="Finest"/>
<xsd:enumeration value="Finer"/>
<xsd:enumeration value="Fine"/>
<xsd:enumeration value="Debug"/>
<xsd:enumeration value="Info"/>
<xsd:enumeration value="Warn"/>
<xsd:enumeration value="Error"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="LogInfo">
<xsd:sequence>
<xsd:element name="category" type="tns:LogCategory"/>
<xsd:element name="level" type="tns:LogCategoryLevel"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="LogType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="None"/>
<xsd:enumeration value="Debugonly"/>
<xsd:enumeration value="Db"/>
<xsd:enumeration value="Profiling"/>
<xsd:enumeration value="Callout"/>
<xsd:enumeration value="Detail"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="DebuggingHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="categories" minOccurs="0" maxOccurs="unbounded" type="tns:LogInfo"/>
<xsd:element name="debugLevel" type="tns:LogType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CallOptions">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="client" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SessionHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="sessionId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AllowFieldTruncationHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="allowFieldTruncation" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="CallResult">
<xsd:sequence/>
</xsd:complexType>
<xsd:complexType name="DocumentLink">
<xsd:sequence/>
</xsd:complexType>
<xsd:element name="logSingleEmail">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="strCustomerEmail" type="xsd:string" nillable="true"/>
<xsd:element name="strIPadUdid" type="xsd:string" nillable="true"/>
<xsd:element name="documents" minOccurs="0" maxOccurs="unbounded" type="tns:DocumentLink" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="logSingleEmailResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="result" type="tns:CallResult" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<!-- Message for the header parts -->
<message name="Header">
<part name="AllowFieldTruncationHeader" element="tns:AllowFieldTruncationHeader"/>
<part name="CallOptions" element="tns:CallOptions"/>
<part name="DebuggingHeader" element="tns:DebuggingHeader"/>
<part name="DebuggingInfo" element="tns:DebuggingInfo"/>
<part name="SessionHeader" element="tns:SessionHeader"/>
</message>
<!-- Operation Messages -->
<message name="logSingleEmailRequest">
<part element="tns:logSingleEmail" name="parameters"/>
</message>
<message name="logSingleEmailResponse">
<part element="tns:logSingleEmailResponse" name="parameters"/>
</message>
<portType name="WS_LogCustomerEmailPortType">
<operation name="logSingleEmail">
<input message="tns:logSingleEmailRequest"/>
<output message="tns:logSingleEmailResponse"/>
</operation>
</portType>
<binding name="WS_LogCustomerEmailBinding" type="tns:WS_LogCustomerEmailPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="logSingleEmail">
<soap:operation soapAction=""/>
<input>
<soap:header use="literal" part="SessionHeader" message="tns:Header"/>
<soap:header use="literal" part="CallOptions" message="tns:Header"/>
<soap:header use="literal" part="DebuggingHeader" message="tns:Header"/>
<soap:header use="literal" part="AllowFieldTruncationHeader" message="tns:Header"/>
<soap:body use="literal" parts="parameters"/>
</input>
<output>
<soap:header use="literal" part="DebuggingInfo" message="tns:Header"/>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="WS_LogCustomerEmailService">
<documentation/>
<port binding="tns:WS_LogCustomerEmailBinding" name="WS_LogCustomerEmail">
<soap:address location="https://cs3-api.salesforce.com/services/Soap/class/WS_LogCustomerEmail"/>
</port>
</service>
</definitions>

 Best regards,

Ivar

 

Hi,

Do you know what would be necessary if our SFDC ORG has apex code that creates the SOAP message programmatically (we are not using WSDL at all).  But now the system we are sending our data to requires authetication.  Is there something that has to be handled in code to add to the SOAP message since it is built by code or is there a point and click way to get the Cerfiticate that they gave me?

 

Thank you for your help.

 

 

 

 

 

Hi,

 

How to customize Notes and Attachment section?Can we make visualforce pages to customize this functionality?

 

Regards,

Devendra

For you experts out there who have done a bunch with the webservices, I am curious. Is it possible for users to create their own, custom web service API methods in the Force.com platform utilizing Apex? For example, a webservices call is sent to the server, such as GetDate, which is an apex defined function (or perhaps a class) that returns, for example, a date? If so, where have I missed the information regarding it in the documentation (or perhaps on the forums)? I've looked around to no avail thus far.

 

Thanks!

  • March 03, 2011
  • Like
  • 0

Hi,

I need to download enterprise wsdl for my production.

The procedure which i am following is :

1) Go to Setup -> Develop -> API

2) Right click on "Generate Enterprise wsdl" and choose "save target as".

 

Saved file is called "generateEnterpriseWsdl.apexp". It doesnt have .wsdl ext.

 

Is this the right procedure?

 

Plz help.

I am trying to select the userrole name of the user who created the case by following code but not able to get it.

It gives me an error in line 3.

 

for (Case c:accs){
User thisUser = [ select Id FROM User where Id =:c.CreatedById];
UserRole userrolle = [ select Id FROM UserRole where Id =:thisUser.UserRoleId];
string rolename = userrolle.Name;

-----------------------------------

-------------------------------

-----


}

I have a web service that I want to call from within an APEX trigger.  I've never done that before.  So this is undiscovered country for me.  My wsdl is as follows:

 

<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions
     name="APEXBPEL"
     targetNamespace="http://xmlns.oracle.com/VUAdvanceSF_jws/SFTest/APEXBPEL"
     xmlns:client="http://xmlns.oracle.com/VUAdvanceSF_jws/SFTest/APEXBPEL"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    >
    <wsdl:types>
        <schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
             xmlns:client="http://xmlns.oracle.com/VUAdvanceSF_jws/SFTest/APEXBPEL" targetNamespace="http://xmlns.oracle.com/VUAdvanceSF_jws/SFTest/APEXBPEL">
            <element name="process">
                <complexType>
                    <sequence>
                        <element name="UserID" nillable="true" minOccurs="0" type="string"/>
                        <element name="BannerID" nillable="true" minOccurs="0" type="string"/>
                        <element name="BannerLastName" nillable="true" minOccurs="0" type="string"/>
                        <element name="Pidm" nillable="true" minOccurs="0" type="decimal"/>
                        <element name="Subject" nillable="true" minOccurs="0" type="string"/>
                        <element name="Comments" nillable="true" minOccurs="0" type="string"/>
                        <element name="AssignedTo" nillable="true" minOccurs="0" type="string"/>
                        <element name="ModifiedDate" nillable="true" minOccurs="0" type="dateTime"/>
                        <element name="ModifiedUser" nillable="true" minOccurs="0" type="string"/>
                        <element name="DataSource" nillable="true" minOccurs="0" type="string"/>
                    </sequence>
                </complexType>
            </element>
        </schema>
    </wsdl:types>
    <wsdl:message name="APEXBPELRequestMessage">
        <wsdl:part name="payload" element="client:process"/>
    </wsdl:message>
    <wsdl:portType name="APEXBPEL">
        <wsdl:operation name="process">
            <wsdl:input message="client:APEXBPELRequestMessage"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="APEXBPELBinding" type="client:APEXBPEL">
        <soap:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="process">
            <soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="document" soapAction="process"/>
            <wsdl:input>
                <soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal" namespace="http://xmlns.oracle.com/VUAdvanceSF_jws/SFTest/APEXBPEL"/>
            </wsdl:input>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="apexbpel_client_ep">
        <wsdl:port name="APEXBPEL_pt" binding="client:APEXBPELBinding">
            <soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="location of service"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

 

When I try to parse the wsdl into APEX is get:

 

Error: Failed to parse wsdl: output not defined in binding operation '{http://xmlns.oracle.com/VUAdvanceSF_jws/SFTest/APEXBPEL}process'

 

I am using fire and forget because (1) I am not sending data back and (2)  I understand that one cannot call a sync web service from inside trigger code.  This wsdl works fine when I test the web service independently of Salesforce.  Anyone have any idea what is amiss here?  Thanks.

 

- Cris

I need to simulate the soql where clause algorithms, in memory, during a trigger execution.

 

I will need to paramterize the coded where clause(s), on trigger fire,  replace the parms with the actual class variable data, and execute the algorithm coded to get a true/false boolean answer.  the algorithm can contain in(list of literals) as well as contatenation of strings. and I supposed lowercaseing..(trying to be generic).

 

I see a couple java classes like this, but nothing in apex..

 

anybody try anything like this?  don't want to dig out my old parsers..

Sam

this technology approach seemed to have good potential, but like all there are issues..

 

we've identified a number that need addressing, bu tthere hasn't been much activity here,

and at least  I have not received any offline contact.

 

is this technology going forward? I have some real technical issues to solve where this might help,

but not in its current form.. do I spend more time waiting here, or do I discard this approach and go back to building something on my own.

 

I'm not complaining, just trying to plan where I spend my time.

 

I MUST solve the problems else my company cannot get their money's worth from the platform licenses they buy

 

sam

I have a field in a custom objec that needs to be set before the data is put in the database.

I want some data (custom field) from the current users record to be copied into one of the fields.

but it needs to be changable later.. (so the field can't be defined as calculated)..

 

but trigger.new.createdby  is not set in the before insert trigger..

 

how can I get access to this info?  the UserInfo object doesn't give me access to the custom fields..

 

thx for any insight

In our service cloud solution, we need case (and other object) comments fields which contain rich media formatting and content.

 

we can create that object pretty easily, and get a related list on the case or other object..  but we lose 2 features

 

1. std casecomments are displayed expanded, so searching all comments works with the browser search (ctrl-f) function

2. because they were expanded you can read across all comments at once.. vs open, read, close, open, read,close.. etc..

 

does anyone have any sample VF code that can handle displaying the list of comments with the Rich text expanded and all visible? (read only)

 

and any code for a search function across data in multiple objects, like I am looking for a specific string in the 100s of comments on this case.. I want to display them opened, with the text highlighted..

 

thanks

 

Sam

 

so, we have this algorithm we developed on our legacy system that helps us calculate the relative priority of customer cases.

we have a large backlog being worked all the time, and its hard to tell which one to select from the list. The customer entered priority is not enough.

 

So, we have this 7 part algorithm that takes cues from other parts of the  customer relationship

 

1. how much pending new business is at risk

2. the age of open cases of each severity (1-4) (the older it gets the higher its priority becomes) for THIS SAME product

3. the size of the sum of their maint contract value (higher means more)

4. what support offerings they have contracted for.. there are potentially15, each has a value..

5. whether they have opened a mgmt review (we call it escalation) of their support service

6. how much contract renewal might be at risk.

7. the priority of existing open cases.

 

today we calculate this once a day for every case. mostly because we have to extract a bunch of data from different systems,

get it into one place, then do the calcs, then take the output and expose it to the case mgmt UI for the user.

with SF, all this data will be locally available now.

 

this would be 'easy' in an apex class, but seems pretty hard in a calculated field.

after all that, this really sounds like NOT a calculated field, but really the output of a timed job that runs thru all the issues and set this field.

 

any other intersting suggestions?  new to sf..

thanks

 

 

 

I am building the java sample..

 

I created my remote access application definition, and copied the key and secret to the environment

as client_id and client_key per the sample.

 

"Copy the consumer key and consumer secret, and set them as environment variables in the project settings in your IDE. For example, in Eclipse Helios, right click the project, and select Properties > Run/Debug Settings > select the project > Edit > Environment. You will also need to add your username and password, plus the Force.com login URL for your org; by default this will be https://login.salesforce.com/ for Developer Edition orgs, https://test.salesforce.com/ for sandboxes. "

 

I get OAuth failed: {"error":"invalid_client_id","error_description":"client identifier invalid"}

 

so, what am I doing wrong? I verified that the correct value is picked up from the environment..

 

using the workbench I see a connection failure after each or every other account update or create, it does not recover.

 

Connection Broken
successful=false
failure=true
channel=/meta/connect
request.channel=/meta/connect
request.connectionType=long-polling
request.id=43
request.clientId=f1kszovhvnv9ufibfe7qn0ez1
advice.reconnect=retry
advice.interval=0
action=connect


I get the following with the sample  VF page displayed.

but no notification from the puhstopic. 

 

sual.force.com/cometd/handshake
200 OK
60ms
jquery (line 7306)
200 OK
52ms
jquery (line 7306)
 
200 OK
83ms
jquery (line 7306)
200 OK
57ms
jquery (line 7306)
200 OK
68ms
jquery (line 7306)
200 OK
49ms
jquery (line 7306)
200 OK
74ms
jquery (line 7306)
200 OK
57ms
jquery (line 7306)
200 OK
63ms
jquery (line 7306)
200 OK
60ms
jquery (line 7306)
200 OK
60ms
jquery (line 7306)
200 OK
59ms
jquery (line 7306)
200 OK
65ms
jquery (line 7306)
200 OK
57ms



we are building out our Serice Cloud implementation, and need to create a custom object while viewing a case.

we created a button on the case, which uses URLFor to open the 'new' page of our custom object.  this works fine..  the page appears and the cancel button returns back to the case.

 

now we want to pre-populate some of the cusotm object fields.

 

so we reviewed the new page filed labels, and used them as the parameters.  and the data appears in the new() object form as expected, except for one.

 

on the object is an Account Lookup field.

 

in the URLFor() we pass CF00NQ0000000ld3l = Case.Accountid as the parameter.  the 18 char account ID string appears in the new() form, but we had expected it would show the 'account Name' instead of the ID field. it reports an error (not found).. if we export the accounts, this IS the id of the account object referenced in the case object.  we cannot manually 'search' using the ID successfuly either.

 

Using the Object field names doesn't work either. 

 

so, what did we miss?

 

we've spent about 12 person hours trying to debug this.. to no avail.

URLFOR($Action.Newobj__c.New,null,[
CF00NQ0000000ld3l_lkid=Case.Account],false);

 

 

sam

we are migrating to Service Cloud from an old legacy system. Our product data is very big, and cumbersome (and can't be improved in the near term).

this makes the data definitions more problematic.. we have 400 serviceable products, many releases per product, and the development shop creates a very discreet product definition package, with  specific supportable parts. overall we have some 50,000 supportable software parts.

 

Our old system hid all this part detail from our users thru the use of specially named and configured queues, product-region-severity.. so there are over 800 of them too.  and u can only see one queues contents at a time.

 

with SC we can fix this outbound part, using the case view definition (we call it filter) and the console or console2 UIs which drive off the view/filter definition.

 

so far so good..

 

but the view editor has some quirks..  to get the magnifying glass to get a list to select from, the data has to be a picklist.. and a picklist can only have 200 elements before the UI starts to put up error messages.. we have 400 products..

if you select 'product', you don't get a view list, you have to type the 'name'.. which in our case is some 40-90 characters long. nobody will get that right.

and we need below product, down to these 'parts'..  but the view editor can't related two fields together (the subparts of A product are smaller than ALL the parts of ALL the products, dependant picklist style)..

 

so, lots of issues..

 

so, we 'could' create a different UI for doing this view definition with VF.. but, unfortunately, there is no customer api to the view definition data object to

'save' it, or recall it for later editing. best we can tell, there is no intent to provide this api..

 

so.. can I get access to this page with UrlFor()? and then stuff the fields that way?  anyone ever tried this? 

all the other technical choices provide really bad options for our users, and they will reject the new system somthing fierce.

(someone just made a java gui that does this new ui over the old system..with over 50% of our user population on the new tool,  so it will be a BIG setback)..

 

I know that I could write my own console app too, using a new data layout for the filter definition, but thats a LONG way down the custom code path I didn't want to go (integrate telephony, knowledge search, the new tabbing format, etc.. )

 

anybody ever try this urlfor() approach for views? search doesn't get me to any examples or other complaints..

 

thanks



we are migrating to Service Cloud from an old legacy system. Our product data is very big, and cumbersome (and can't be improved in the near term).

this makes the data definitions more problematic.. we have 400 serviceable products, many releases per product, and the development shop creates a very discreet product definition package, with  specific supportable parts. overall we have some 50,000 supportable software parts.

 

Our old system hid all this part detail from our users thru the use of specially named and configured queues, product-region-severity.. so there are over 800 of them too.  and u can only see one queues contents at a time.

 

with SC we can fix this outbound part, using the case view definition (we call it filter) and the console or console2 UIs which drive off the view/filter definition.

 

so far so good..

 

but the view editor has some quirks..  to get the magnifying glass to get a list to select from, the data has to be a picklist.. and a picklist can only have 200 elements before the UI starts to put up error messages.. we have 400 products..

if you select 'product', you don't get a view list, you have to type the 'name'.. which in our case is some 40-90 characters long. nobody will get that right.

and we need below product, down to these 'parts'..  but the view editor can't related two fields together (the subparts of A product are smaller than ALL the parts of ALL the products, dependant picklist style)..

 

so, lots of issues..

 

so, we 'could' create a different UI for doing this view definition with VF.. but, unfortunately, there is no customer api to the view definition data object to

'save' it, or recall it for later editing. best we can tell, there is no intent to provide this api..

 

so.. can I get access to this page with UrlFor()? and then stuff the fields that way?  anyone ever tried this? 

all the other technical choices provide really bad options for our users, and they will reject the new system somthing fierce.

(someone just made a java gui that does this new ui over the old system..with over 50% of our user population on the new tool,  so it will be a BIG setback)..

 

I know that I could write my own console app too, using a new data layout for the filter definition, but thats a LONG way down the custom code path I didn't want to go (integrate telephony, knowledge search, the new tabbing format, etc.. )

 

anybody ever try this urlfor() approach for views? search doesn't get me to any examples or other complaints..

 

thanks

 

 

we are a worldwide company 24x7 and have many processes which span timezones and location business hours.

we have a table in our old system of business hours by country..   no problem, I can do that in SF too..

 

so I defined the default (us eastern), used the bulk loaded to extract it (to get the data format)

modeled my 187 records after that model

 

but bulk load fails with a ' need a sundastarttime', value provided incorrect.. 08:00:00.00Z

which matches exactly the extract format. hh:mm:ss.ttZ... timezone def

 

anyone have the magic incantation to help me understand this?

I can type them in.. but why do that...

 

Sam

I am building a tree view using datalist over a set of custom data.

 

the controller has two functions.. the constructor, which builds the outermost list, once

and a function that uses the data in the outer list, once per item to get the sub items.

 

the subfunction uses a static counter to index into the outer list, and then increments the coutner for the

next call .. whihc never comes.

 

the apex code is

 

<apex:datalist value={!outer} var="top">

    <apex:outputtext value="{!top.name}"/>

    <apex:datalist value="{!inner}" var="inner">

         <apex:outputtext value="{!inner.label}"/>

    </apex:datalist>

</apex:datalist>

 

the tree is built correctly as far as indentation is concerned, but the getInner() function is only called once,

according the debug log I built.

 

the getInner() is called with the static index set to 0, it correctly uses he first element of the outer list as the key on a new soql stmt, and build the inner list.. then increments the static counter.

 

but getInner() is never called again.

 

is there some way to specify that getInner() should be called everytime as the data is 'volitle'?

 

 

the apex code for the controller is

 

public class classname {

  private static integer index = 0;

  public List <class> familys {get; set;}

  public List <class2> getinner()
  {
      List<class2> varname = [select label from class2 where name = :familys.get(index).name];
      index = index +1;
      return varname;
  }

  public classname(){ 
     familys = [select name from class order by name asc];
  }
}

 

 

so the constructor builds the outer list one time;

and then the getInner() is called to get the dependant inner list

 

the generated output is

 

<ul>
 <li>outer 1</li>
  <ul>
     <li>inner 1 of outer 1</li>
     <li>inner 2 of outer 1</li>
     <li>inner 3 of outer 1</li>
  </ul>
 <li>outer 2</li>
  <ul>
     <li>inner 1 of outer 1</li>
     <li>inner 2 of outer 1</li>
     <li>inner 3 of outer 1</li>
  </ul>
 <li>outer 3</li>
  <ul>
     <li>inner 1 of outer 1</li>
     <li>inner 2 of outer 1</li>
     <li>inner 3 of outer 1</li>
  </ul>
</ul>

 

but the function to get the inner list is only called ONE time.

 

I can change the initial value of index from 0 to some other value, and the appropriate dependant list is built.

so I know the code in the getInner() function works properly if it would be called.

 

what did I misunderstand?

 

I need to rewrite the view filter control to handle our  product list.

 

so I want so do this with a tree control, with cascading checkbox,

 

expand a branch, select a sub-branch(selects all children), expand a sub branch and de-select one element or deeper sub branch. (delesects all children)..

 

I see need for tree, but don't see a solution..

 

is this a flash tool?

 

Sam

as we migrate to SFDC from our legacy systemm I have to decide how to deal with a large dependant picklist.

 

the controlling field has 1027 selectable values, and there are 5,000 total dependent values over the 1027 primary values.

 

SF dependant picklist controlling field only supports 300 values..

 

has anyone made a solution that supports larger amounts of data..

 

I know I can attempt to redesign the data, but we have a number of business processes that would also need to be revised.

and that work is scheduled in a subsequent release after migration..

 

ideas welcomed..

 

Sam

 

I am synchronizing a custom object with a remote system. I developed a trigger to do this.

 

the trigger runs great, and the remote system updates as expected..

changes on the remote side update the record as well.

 

but.. I need to differentiate between the two systems updating the same object.

to stop trigger recursion.

 

I have a flag field on the record, and the remote api sets this field to true.

 

the trigger fires and checks the field.. if set, do NOT send updates.. as we are processing because of inbound updates

 

changing_object__c c = Trigger.new[i];
if(c.isApi__c==false)

however, when the SF UI changes the record, I DO want to send updates..

how can I tell (before update) which source caused the change?

 

thanks..

 

Sam

We need to integrate SFDC service cloud with our on premise application..

 

There are two different approaches, and I have both working

 

1. create outbound message and workflow to trigger sending updates when records change

     this supports store & forward, retry, queuing, message batching, sessionid provided for callback

 

     but, it is limited to the fields of ONE record type..

          there is an expected response code, and a response timeout (few seconds)

     to get any additional data, the message

     receiver must callback to sfdc to collect the rest of the data..

     THIS connection is not guaranteed of course..

 

2. create your own web service, and message (develop wsdl, build server and import as class into sfdc)

     and then in the class (with some special coding), collect all the data into the custom message,

     then send (using @future).. use a trigger to fire off the class as required.

     this works very well, is about  5 times faster than the outbound message with callbacks.

 

     but, there is no store and forward, retry, ...

     I don't see any mechanism to do this on the salesforce server side.

 

I am strongly in favor of approach 2, as there could be hundreds of records required on access to complete the data

and accessing them remotely is really bad form to my system design & implementation experience.. access the data locally always, unless forced, in the exception, to access remotely..

 

in either case the message receiver must implement some JMS to queue the messages and process them asynchronously.

 

the data is a combination of fields from records, and a list of all the comments and attachments to the modified record.

the list is variable length. sf does this with foreign key tables not with actual data in the base object.   so on failure, I would have to store off all the data, then reconstruct it..

 

I can't lookup the data at a later time, as the data might have change since the first update, I need to apply changes in order, and don't have a method for combining changes prior to distribution.

 

anyone have any pointers to how others might have solved this? I searched on outbound, syncronization (with and without the H), guaranteed, recovery....

 

I have both methods implemented and can toggle between them by activating the trigger and deactivating the outbound message and vice versa.

 

I still have to design recoverability on the opposite end

 

Sam

 

I am getting this error after calling the Salesforce SOAP WSDL Based service:

 

No such column 'Jigsaw' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names."

 

Looks like the WSDL schema provided the Account with Jigsaw fields like sample shown below, but when the service calls the salesforce this fields are not recognized, I tried to run the SOSQL generated by service directly within the salesforce SQL Tool and there also I get the same no such column 'Jigsaw' is message, Any ideas? Any setting needed to be set in salesforce to allow these fields to be accessible???:

 

<

complexTypename="Account">

<

complexContent>

<

extensionbase="ens:sObject">

<

sequence>

<

elementname="Jigsaw"nillable="true"minOccurs="0"type="xsd:string"/>

<

elementname="JigsawCompanyId"nillable="true"minOccurs="0"type="xsd:string"/>

 

 

  • October 13, 2011
  • Like
  • 0

Hi 

 

I am trying to parse the xml response as found below, but i am facing difficulty in parsing this using Xml Dom class....I am totally stuck here , any help , examples , solutions are  totally appreciated.

 

 
<?xml version="1.0" encoding="UTF-8"?>
<Service_User generator="zend" version="1.0">
<get_user_grades>
<users>
<id_35>
<user>
<id>35</id>
<fullname>SamSmith</fullname>
<username>test@erx.com</username>
<idnumber>003K0000002M9xJIAS</idnumber>
</user>
</id_35>
</users>
<courses>
<id_13>
<course>
<id>13</id>
<fullname>EDTC-5100: Fake Course</fullname>
<shortname>5100</shortname>
<idnumber>
</idnumber>
</course>
</id_13>
</courses>
<gradeitems>
<gradeitem>
<courseid>13</courseid>
<itemtype>mod</itemtype>
<itemname>Assessment 1 - Test Quiz A</itemname>
<itemmodule>quiz</itemmodule>
<iteminstance>10</iteminstance>
<grades>
<grade>
<id>29</id>
<userid>35</userid>
<registrationid></registrationid>
<finalgrade>90.00000</finalgrade>
<gradeletter>A-</gradeletter>
<gradepercent>90.00 %</gradepercent>
<timemodified>1317928200</timemodified>
<deleted>0</deleted>
</grade>
</grades>
</gradeitem>
</get_user_grades>
</Service_User>

 

Thanks

Dear all,

 

here is my problem/question.

 

In the controller (extension) of one of my pages, I get an expression in a String variable. 

I would like to know if the re is any solution for me to evaluate this expression from the String.

Let's say I get something like this:

 

String s = '(true AND false) OR true';

 

Is there any function (like the eval javascript function) that would allow me to evaluate my expression?

 

Boolean ret = eval(s); // true

 

Thank you everyone in advance.

 

 

Hi

 

I m trying to callout an external API using the following code :

 

public class Testapicall {

 
  public String resultProp {get;set;}                                  //Prop for result
  public String inputProp {get;set;}                                   //Prop for input

 
  public PageReference submit() {                                      // On submit button click
         resultProp = getResult(inputProp);                            // Call function getResult that makes HTTP POST call to internal API
         return null;
      }
     
 
    
  private String getResult(String inputProp) {                         // HTTP POST and results back
        
     String json;                                                      // for storing back the json response of the HTTP call
     
     HttpRequest req = new HttpRequest();                              // POST method calling
     Http http = new Http();
     req.setMethod('POST');       
    
     req.setTimeout(2000);          
    
     String username = 'abc';
     String password = 'def';                                     // Settting up of username and password
     String contentTypes = 'application/json';
     String accepting = 'application/json';
    
    
      
     Blob headerValue = Blob.valueOf(username + ':' + password);                          //Setting header values
     String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
     req.setHeader('Authorization', authorizationHeader);
      
        
     req.setHeader('Content-Type', contentTypes);
     req.setHeader('Accept', accepting);
    
     String inp= '{"version": "1.1","method": "sforce_ping","params":{"name":"HELLO"}}';
     req.setBody(inp);                                                                                                                            
    
     String url = 'http://abcd.com:3100/services';         // Setting up end point
     req.setEndpoint(url);
     HTTPResponse resp = http.send(req);                               // Getting back the response
    
          System.debug(resp.toString());
          System.debug('STATUS:'+resp.getStatus());
          System.debug('STATUS_CODE:'+resp.getStatusCode());
    
     json = resp.getBody().replace('\n','');                           // Storing json in the 'json' string
     json = json.replace('\r','');
        
    try{
     String json1=json.replace('\t','');                                // Removing whitespace from json and storing it in json1
    
           System.debug('reading response as json1--->>>>' + json1 );         // ((((((((DEBUG POINT))))))))))
    
     JSONObject j = new JSONObject(json1);                              // JSONize
    
           System.debug('reading response as json object j --->>>>' + j );   // ((((((((DEBUG POINT))))))))))
         
     return toFinalResult(j).toDisplayString();                         // Calling Function toFinalResult which fetches the response from the JSONized response
     }
    catch (JSONObject.JSONException e) {                                // Exception handling
     return 'Error parsing JSON response: '+e;
     }
   
  }
 
 
  private FinalResult toFinalResult(JSONObject resp) {                  // Function toFinalResult which fetches the response from the JSONized response
     FinalResult finalres = new FinalResult();
     try {
          finalres.version = resp.getString('version');                    // Fetching the version
          finalres.result = resp.getString('result'); 
     }
     catch (Exception e) {
     //fail
     }
     return finalres;
  }
    
  private class FinalResult {                                            // Class to display final result
         public String version;
         public String result;
         public String toDisplayString() {
         return result;
        
         }
      }
     
  }

 

The curl request that works fine is :

curl -X POST -H "Content-Type: application/json" -H "Accept:application/json" -u abc:def -d '{"version": "1.1","method": "sforce_ping","params":{"name"

The curl response is :
{"version": "1.1", "result": "\"HELLO\""}
Can some one guide me where I m going wrong as it always calls that exception of timeout. Is it the Authentication issue?



  • October 06, 2011
  • Like
  • 0

Hi.
I have a problem that I can't get around in my code. I have a small webservice that receives data from an outside source and uses that to construct a task and associate it with a contact or lead. the webservice has only one method called "logSingleEmail". This method takes a list of a custom class called DocumentLink as one of it's arguments.  Now all tests run normally and I am able to invoke this code successfully from Eclipse as anonymous code. The problem is that the WSDL doesn't list the attributes of the DocumentLink class, and my customer can't invoke the webservice as a result.
Hopefully this is just some small oversight on my behalf that someone can help me with. Included below are both the code from my webservice as well as the generated wsdl:

 

APEX CODE:

 

global class WS_LogCustomerEmail {
	
	static webservice CallResult logSingleEmail( String strCustomerEmail, String strIPadUdid, List<DocumentLink> documents ){
		//lookup lead/contact from strCustomerEmail
		
		Boolean bWasFound = false;
		Contact c = new Contact();
		Lead l = new Lead();
		try{
			l = [Select Id from Lead where Email =: strCustomerEmail limit 1];
		}
		catch( Exception e){
		
	
			try{
				c = [Select Id from Contact where Email =: strCustomerEmail limit 1];
				bWasFound = true;
			}
			catch( Exception ex){
				return new CallResult('Email not found');
			}
			/*if( c != null ) bWasFound = true;
			else return new CallResult('Customer email was not found in Salesforce');
			*/
		}
		
		
		//construct email body from list and strIPadUdid
		String emailBody = 'The following document links were sent via offline catalog:\n\n';
		for( DocumentLink link:documents){
			emailBody += link.strDocumentName + ' - ' + link.strDocumentUrl + '\n';
		}
		emailBody += '\n from user: ' + strIPadUdid;
		
		Task t = new Task();
		if( l.Id != null) t.WhoId = l.Id;
		else if( c.Id != null) t.WhoId = c.Id;
		else return new CallResult('Unknown customer Id');
		
		t.Description = emailBody;
		t.Subject = 'Documents from offline catalog';
		
		try{
			insert t;
		}
		catch ( Exception e){
			return new CallResult(e.getMessage());
		}
		
		return new CallResult('1');	
	}
	
	global class CallResult{
		public String strResult;
		public Callresult( String strIn ){ strResult = strIn; }	
	}
	
	global class DocumentLink{
		public String strDocumentName;
		public String strDocumentUrl;
		
	}
	
	static testMethod void coverCodeForService(){
		Lead l = new Lead();
		l.Email = 'ivargu@thisisjustfortestingpurposes.com';
		l.LastName = 'Gunnarsson';
		l.Company = 'MyCompany';
		insert l;
		
		DocumentLink dl = new DocumentLink();
		dl.strDocumentName = 'Name';
		dl.strDocumentUrl = 'http://www.mbl.is';
		List<DocumentLink> dlList = new List<DocumentLink>();
		dlList.add(dl);
		
		CallResult result = logSingleEmail( 'ivargu@thisisjustfortestingpurposes.com', '12345', dlList );
		
		
	}
}

   WSDL:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<!-- Web Services API : WS_LogCustomerEmail -->
<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://soap.sforce.com/schemas/class/WS_LogCustomerEmail" targetNamespace="http://soap.sforce.com/schemas/class/WS_LogCustomerEmail">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://soap.sforce.com/schemas/class/WS_LogCustomerEmail">
<xsd:element name="DebuggingInfo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="debugLog" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="ID">
<xsd:restriction base="xsd:string">
<xsd:length value="18"/>
<xsd:pattern value="[a-zA-Z0-9]{18}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LogCategory">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Db"/>
<xsd:enumeration value="Workflow"/>
<xsd:enumeration value="Validation"/>
<xsd:enumeration value="Callout"/>
<xsd:enumeration value="Apex_code"/>
<xsd:enumeration value="Apex_profiling"/>
<xsd:enumeration value="Visualforce"/>
<xsd:enumeration value="System"/>
<xsd:enumeration value="All"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LogCategoryLevel">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Internal"/>
<xsd:enumeration value="Finest"/>
<xsd:enumeration value="Finer"/>
<xsd:enumeration value="Fine"/>
<xsd:enumeration value="Debug"/>
<xsd:enumeration value="Info"/>
<xsd:enumeration value="Warn"/>
<xsd:enumeration value="Error"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="LogInfo">
<xsd:sequence>
<xsd:element name="category" type="tns:LogCategory"/>
<xsd:element name="level" type="tns:LogCategoryLevel"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="LogType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="None"/>
<xsd:enumeration value="Debugonly"/>
<xsd:enumeration value="Db"/>
<xsd:enumeration value="Profiling"/>
<xsd:enumeration value="Callout"/>
<xsd:enumeration value="Detail"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="DebuggingHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="categories" minOccurs="0" maxOccurs="unbounded" type="tns:LogInfo"/>
<xsd:element name="debugLevel" type="tns:LogType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CallOptions">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="client" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SessionHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="sessionId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AllowFieldTruncationHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="allowFieldTruncation" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="CallResult">
<xsd:sequence/>
</xsd:complexType>
<xsd:complexType name="DocumentLink">
<xsd:sequence/>
</xsd:complexType>
<xsd:element name="logSingleEmail">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="strCustomerEmail" type="xsd:string" nillable="true"/>
<xsd:element name="strIPadUdid" type="xsd:string" nillable="true"/>
<xsd:element name="documents" minOccurs="0" maxOccurs="unbounded" type="tns:DocumentLink" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="logSingleEmailResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="result" type="tns:CallResult" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<!-- Message for the header parts -->
<message name="Header">
<part name="AllowFieldTruncationHeader" element="tns:AllowFieldTruncationHeader"/>
<part name="CallOptions" element="tns:CallOptions"/>
<part name="DebuggingHeader" element="tns:DebuggingHeader"/>
<part name="DebuggingInfo" element="tns:DebuggingInfo"/>
<part name="SessionHeader" element="tns:SessionHeader"/>
</message>
<!-- Operation Messages -->
<message name="logSingleEmailRequest">
<part element="tns:logSingleEmail" name="parameters"/>
</message>
<message name="logSingleEmailResponse">
<part element="tns:logSingleEmailResponse" name="parameters"/>
</message>
<portType name="WS_LogCustomerEmailPortType">
<operation name="logSingleEmail">
<input message="tns:logSingleEmailRequest"/>
<output message="tns:logSingleEmailResponse"/>
</operation>
</portType>
<binding name="WS_LogCustomerEmailBinding" type="tns:WS_LogCustomerEmailPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="logSingleEmail">
<soap:operation soapAction=""/>
<input>
<soap:header use="literal" part="SessionHeader" message="tns:Header"/>
<soap:header use="literal" part="CallOptions" message="tns:Header"/>
<soap:header use="literal" part="DebuggingHeader" message="tns:Header"/>
<soap:header use="literal" part="AllowFieldTruncationHeader" message="tns:Header"/>
<soap:body use="literal" parts="parameters"/>
</input>
<output>
<soap:header use="literal" part="DebuggingInfo" message="tns:Header"/>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="WS_LogCustomerEmailService">
<documentation/>
<port binding="tns:WS_LogCustomerEmailBinding" name="WS_LogCustomerEmail">
<soap:address location="https://cs3-api.salesforce.com/services/Soap/class/WS_LogCustomerEmail"/>
</port>
</service>
</definitions>

 Best regards,

Ivar

 

Hi Guys, 

 

I'm kind of new to Salesforce. I have managed to produce the following, which works well, apart from the fact that the sorting is not happening:

 

<Div id="Childs1">

<apex:pageBlock > 

<apex:pageBlockTable rendered="true" value="{!Trading_Contract__c.TC_SH__r}" var="child1" width="100%"> 

 <apex:column value="{!child1.Shipment_Ref__c}"/>    <apex:column headerValue="Date">   

<apex:outputText value="{0,date,yyyy-MM}"> <apex:param value="{!child1.Date__c}" />

</apex:outputText>

</apex:column>

<apex:column value="{!child1.Bulk_Quantity__c}"/>   

<apex:column value="{!child1.Destination_Port_Place__c}"/> 

</apex:pageBlockTable>

 </apex:pageBlock>

</Div>

 

Trading_Contract__c is must costom object, linked to TC_SH__r which is another custom "Shipments" object. 

 

What is the best way to sort the above pageblock table???

 

I would really appreciate the help!

 

Thanks

 

Stadler - Admin

  • September 29, 2011
  • Like
  • 0

Hi,

Do you know what would be necessary if our SFDC ORG has apex code that creates the SOAP message programmatically (we are not using WSDL at all).  But now the system we are sending our data to requires authetication.  Is there something that has to be handled in code to add to the SOAP message since it is built by code or is there a point and click way to get the Cerfiticate that they gave me?

 

Thank you for your help.

 

 

 

 

Hello,

            I have some issues while building jstree with salesforce. i have attached following files in the the static resource.

 

 

<apex:stylesheet value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/themes/default/style.css')}"/>
     <apex:stylesheet value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/themes/apple/style.css')}"/>  
     <apex:stylesheet value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/themes/classic/style.css')}"/>  
     <apex:stylesheet value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/themes/default-rtl/style.css')}"/>       
     
    
     <apex:includeScript value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/jquery.cookie.js')}"/>
     <apex:includeScript value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/jquery.hotkeys.js')}"/>
     <apex:includeScript value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/jquery.js')}"/>
     <apex:includeScript value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/jquery.jstree.js')}"/>
     <apex:includeScript value="{!$Resource.treejs}"/>

 

 

i have written following code for that but it is not working and giving me javascript error that jstree is not  a function.here is the javascript code given below.

 

  <!--  jquery for activity tree -->
        var selectedActivityName = '';
    	var $jq  = jQuery.noConflict();
    	
			function createRootActivity() {
				nd = $jq("#demo").jstree('get_selected');
				$jq("#demo").jstree("create",-1,false,"No rename",false,false);
			}
			
			//NOT USED AS OF NOW
			function createActivity(e) {
				$jq("#demo").jstree("create"); 
			}
			
			//NOT USED AS OF NOW
			function renameActivity(e) {
				$jq("#demo").jstree("rename"); 
			}
			
			function setSelectedActivity(selActivityName) {
				selectedActivityName = selActivityName;
			}
			
			var newActivitParentName = '';
			function setNewActivityParentName(parentActName) {
				newActivitParentName = parentActName;
			}
			
			var newActivityName = '';
			function setActivityNewName(newName) {
				//alert('newName:'+newName);
				newActivityName = newName;
			}
		
			$jq(function () {
				$jq("#create_1").click(createRootActivity);
				//$jq("#create_2").click(createActivity);
				//$jq("#rename").click(renameActivity);
				
			});
			
			var activityMoved = '';
			var newActivityPosition = '';
			var newActivityParent = '';
			var keepOriginalActivity = '';
			function changePositionOfActivity(activityName,newPosition,newParentAcitivityName, keepOrigNode) {
				//alert("activityName:"+activityName);
				//alert("newPosition:"+newPosition);
				//alert("newParentAcitivityName:"+newParentAcitivityName);
				//alert("keepOrigNode:"+keepOrigNode);
				
				activityMoved = activityName;
				newActivityPosition = newPosition;
				newActivityParent = newParentAcitivityName;
				keepOriginalActivity = keepOrigNode;
			}
		
			$jq(function () {
			    $jq("#demo")
			    .bind("open_node.jstree create_node.jstree close_node.jstree select_node.jstree move_node.jstree rename_node.jstree cut_node.jstree", function (e, data) {
					if(e.type == 'create_node') {
						movObject = data.args[0];
						setNewActivityParentName($jq("#demo").jstree("get_text",movObject));
					}
				    if(e.type == 'move_node') {
						movObject = data.args[0];
						var keepOrigNode = false;
						if(data.args[3]) {keepOrigNode=true;}
						changePositionOfActivity(movObject.o.text(),movObject.cp,$jq("#demo").jstree("get_text",movObject.np),keepOrigNode);
					}
					if(e.type == 'select_node') {
						setSelectedActivity($jq("#demo").jstree("get_text",data.inst.get_selected()));
					}
					if(e.type == 'rename_node') {
						alert("node renamed");
						movObject = data.args[0];
						setActivityNewName($("#demo").jstree("get_text",movObject));
					}
			    })
			        
			    .jstree({
			        "core" : { "initially_open" : [ "root" ] },
			        
			        "html_data" : {
			            "data" : "<ul><li id='rhtml_1'><a href='#'>Root node 1</a><ul><li id='rhtml_2'><a href='#'>Child node 1</a></li><li id='rhtml_3'><a href='#'>Child node 2</a></li><li id='rhtml_4'><a href='#'>Child node 3</a></li><li id='rhtml_5'><a href='#'>Child node 4</a></li></ul></li><li id='rhtml_6'><a href='#'>Root node 2</a></li><li id='rhtml_7'><a href='#'>Root node 3</a></li></ul>"
		
			    	},
			    	"dnd" : {
				    	"drop_finish" : function () {
			                alert("DROP");
			            },
			            "drag_finish" : function (data) {
			                alert("DRAG OK");
			                alert(data.r);
			            },
			    	},
			    	"ui" : {
			            "select_limit" : 1
			        },
			        "contextmenu" : {
				        	"select_node"		: true,
							"show_at_node"		: false,
							"rename" : {
								"label"				: "Rename",
								// The function to execute upon a click
								"action"			: function (obj) { alert('1');this.rename(obj); },
								// All below are optional 
								"_disabled"			: false,		// clicking the item won't do a thing
								"_class"			: "class",	// class is applied to the item LI node
								"separator_before"	: false,	// Insert a separator before the item
								"separator_after"	: true,		// Insert a separator after the item
								// false or string - if does not contain `/` - used as classname
								"icon"				: true,
								"submenu"			: { 
									/* Collection of objects (the same structure) */
								}
							}
						},
			        "plugins" : [ "themes", "html_data", "dnd", "ui", "crrm","contextmenu" ]
			    });
			});

 

 

and page code is given below.

 

 

<apex:outputPanel id="outPanel" >
                                            	<div id="demo" class="demo"></div>   
                                            </apex:outputPanel>

 

if anyone has any idea pleas tell me.