-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
15Questions
-
11Replies
Help with display
- msc7808
- July 08, 2009
- Like
- 0
- Continue reading or reply
Need assistance with WebService
Hi Guys, I need some assistance with basic WebService. I have put together a dummy service using the Orders table in the Northwind Database which returns Dataset of all the Orders for a particular Customer. Requires CustomerID as Parameter.
Here is the XML when the Service is invoked with "ALFKI" customer id.
<?xml version="1.0" encoding="utf-8" ?>
- <DataSet xmlns=http://172.16.1.254>
- <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Table">
- <xs:complexType>
- <xs:sequence>
<xs:element name="OrderID" type="xs:int" minOccurs="0" />
<xs:element name="CustomerID" type="xs:string" minOccurs="0" />
<xs:element name="EmployeeID" type="xs:int" minOccurs="0" />
<xs:element name="OrderDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="RequiredDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ShippedDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="ShipVia" type="xs:int" minOccurs="0" />
<xs:element name="Freight" type="xs:decimal" minOccurs="0" />
<xs:element name="ShipName" type="xs:string" minOccurs="0" />
<xs:element name="ShipAddress" type="xs:string" minOccurs="0" />
<xs:element name="ShipCity" type="xs:string" minOccurs="0" />
<xs:element name="ShipRegion" type="xs:string" minOccurs="0" />
<xs:element name="ShipPostalCode" type="xs:string" minOccurs="0" />
<xs:element name="ShipCountry" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <NewDataSet xmlns="">
- <Table diffgr:id="Table1" msdata:rowOrder="0">
<OrderID>10643</OrderID>
<CustomerID>ALFKI</CustomerID>
<EmployeeID>6</EmployeeID>
<OrderDate>1997-08-25T00:00:00-04:00</OrderDate>
<RequiredDate>1997-09-22T00:00:00-04:00</RequiredDate>
<ShippedDate>1997-09-02T00:00:00-04:00</ShippedDate>
<ShipVia>1</ShipVia>
<Freight>29.4600</Freight>
<ShipName>Alfreds Futterkiste</ShipName>
<ShipAddress>Obere Str. 57</ShipAddress>
<ShipCity>Berlin</ShipCity>
<ShipPostalCode>12209</ShipPostalCode>
<ShipCountry>Germany</ShipCountry>
</Table>
+ <Table diffgr:id="Table2" msdata:rowOrder="1">
<OrderID>10692</OrderID>
<CustomerID>ALFKI</CustomerID>
<EmployeeID>4</EmployeeID>
<OrderDate>1997-10-03T00:00:00-04:00</OrderDate>
<RequiredDate>1997-10-31T00:00:00-04:00</RequiredDate>
<ShippedDate>1997-10-13T00:00:00-04:00</ShippedDate>
<ShipVia>2</ShipVia>
<Freight>61.0200</Freight>
<ShipName>Alfred's Futterkiste</ShipName>
<ShipAddress>Obere Str. 57</ShipAddress>
<ShipCity>Berlin</ShipCity>
<ShipPostalCode>12209</ShipPostalCode>
<ShipCountry>Germany</ShipCountry>
</Table>
+ <Table diffgr:id="Table3" msdata:rowOrder="2">
<OrderID>10702</OrderID>
<CustomerID>ALFKI</CustomerID>
<EmployeeID>4</EmployeeID>
<OrderDate>1997-10-13T00:00:00-04:00</OrderDate>
<RequiredDate>1997-11-24T00:00:00-05:00</RequiredDate>
<ShippedDate>1997-10-21T00:00:00-04:00</ShippedDate>
<ShipVia>1</ShipVia>
<Freight>23.9400</Freight>
<ShipName>Alfred's Futterkiste</ShipName>
<ShipAddress>Obere Str. 57</ShipAddress>
<ShipCity>Berlin</ShipCity>
<ShipPostalCode>12209</ShipPostalCode>
<ShipCountry>Germany</ShipCountry>
</Table>
</NewDataSet>
</diffgr:diffgram>
</DataSet>
NOTE: Customer can have one or more orders.
I have the following code which grabs the XML and stores it in MAP. I am using Map for the first time so need some assistance on how to iterate the MAP and grab values and store it in Custom Object.
global class WSUpdates{
WebService static Integer InsertOrders(String CustomerName,String CustomerID, String UserName,String RecordID )
{
Map<string,string> Orders= new Map<string,string>();
HttpRequest req = new HttpRequest();
req.setEndpoint('http://http://172.16.1.254/dummywebservice/OrderInfo.asmx');
req.setMethod('POST');
req.setHeader('Content-Type', 'text/xml; charset=utf-8');
req.setHeader('SOAPAction', 'http://http://172.16.1.254/GetOrders');
string b = '<?xml version="1.0" encoding="utf-8"?>';
b += '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
b += '<soap:Header>';
b += '<ServiceAuthHeader xmlns="http://172.16.1.254">';
b += '<Username>Username</Username>';
b += '<Password>Password</Password>';
b += '</ServiceAuthHeader>';
b += '</soap:Header>';
b += '<soap:Body>';
b += '<GetOrders xmlns="http://172.16.1.254">';
b += '<ID>' + CustomerID + '</ID>';
b += '</GetOrders>';
b += '</soap:Body>';
b += '</soap:Envelope>';
req.setBody(b);
Http http = new Http();
HTTPResponse res = http.send(req);
XmlStreamReader reader = new XmlStreamReader(res.getBody());
CustomOrder__c[] orders = new CustomOrder__c[0];
while(reader.hasNext())
{
if (reader.getEventType() == XmlTag.START_ELEMENT)
{
string FieldName = reader.getLocalName();
reader.next();
if (reader.getEventType() == XmlTag.CHARACTERS)
{
Orders.put(FieldName, reader.getText());
}
}
reader.next();
}
//I dont know how to proceed from here. What I am trying to do here is contact the WebService, and use XMLStreamreader to read the XML Response, parse it and store it in the MAP object. Need to iterate the MAP, get the values and store it in Custom Object.
//THis is just sample code i have put together
Orders.add(new CustomOrder__c(ItemName='Dummy',OrderDate__c='Date',RequiredDate__c='REQDDate'));
insert Orders
//return Orders.size();
}
}
Thanks for your help.
Manny
- msc7808
- July 06, 2009
- Like
- 0
- Continue reading or reply
Need Help
Hey Guys,
I have defined two custom objects as follows:
(1) Hotel Record Name: HotelName
(2) CustomContact Record Name: Full Name Sec Field Hotel: Lookup(Hotel)
I have Apex Code
CustomContact__c[] contacts = new CustomContact__c[0];
contacts.add(new CustomContact__c(Business_Title__c='test',TypeofContact__c='Hotel',Hotel__c=HotelName,Name='John Doe'));
I am getting an error:
A problem with the OnClick JavaScript for this button or link was encountered:
{faultcode:'soapenv:Client', faultstring:'System.StringException: Invalid id: Dummy Hotel Class.WSUpdates.InsertHotelContacts: line 39, column 115', }
Please advise what could be wrong.
THanks
Manny
- msc7808
- July 05, 2009
- Like
- 0
- Continue reading or reply
Detect Duplicate
Hey Guys,
Is there any way to detect a duplicate in the Child Object before a record Item is actually saved?
Sample Object:
HotelName Lookup field
AirportName Lookup field
AirportDistance text
AirportDirection PickVal
I would like the system to check if the record already exists and prompt the user to select again.
Thanks
Manny
- msc7808
- July 02, 2009
- Like
- 0
- Continue reading or reply
Auto Fill Recordname
Hey Guys, I am just curious as to if this can be done or not. I have created an Object HotelContacts with RecordName "Full Name". Also there are other fields defined such as Salutation, FirstName, MI and LastName. What i need to do is to have a user enter these fields and auto-fill Salutation based on the other fields.
Is this possible to do?
Thanks
Manny
- msc7808
- July 02, 2009
- Like
- 0
- Continue reading or reply
Unable to parse WSDL
Hey Guys,
I am getting an error while trying to parse a WSDL:
Here is the WSDL for the Webservice:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://207.97.239.184" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://207.97.239.184" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://207.97.239.184">
<s:element name="FindCustomer">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CustomerID" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="FindCustomerResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="FindCustomerResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="FindCustomerSoapIn">
<wsdl:part name="parameters" element="tns:FindCustomer" />
</wsdl:message>
<wsdl:message name="FindCustomerSoapOut">
<wsdl:part name="parameters" element="tns:FindCustomerResponse" />
</wsdl:message>
<wsdl:portType name="ServiceSoap">
<wsdl:operation name="FindCustomer">
<wsdl:input message="tns:FindCustomerSoapIn" />
<wsdl:output message="tns:FindCustomerSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="FindCustomer">
<soap:operation soapAction="http://207.97.239.184/FindCustomer" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="FindCustomer">
<soap12:operation soapAction="http://207.97.239.184/FindCustomer" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service">
<wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">
<soap:address location="http://207.97.239.184/dummywebservice/service.asmx" />
</wsdl:port>
<wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12">
<soap12:address location="http://207.97.239.184/dummywebservice/service.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Please assist.
Manny
- msc7808
- July 01, 2009
- Like
- 0
- Continue reading or reply
Scheduling/Webservice
Hey Guys,
I have a requirement from the client as follows:
At a certain time of the day I need to connect to our partner WebService and pass modifiied/new contacts, accounts to their system.
How can I set this in Salesforce?
Thanks
MS
- msc7808
- June 27, 2009
- Like
- 0
- Continue reading or reply
Sample Application
Hey Guys,
Do you know if there is any sample application such as the Recruiter app posted online for trianing?
Thanks
MSC
- msc7808
- June 26, 2009
- Like
- 0
- Continue reading or reply
Mass Delete
Hey Guys,
I have added Mass Delete button on Contacts Related list under Accounts. Copied the code as mentioned in the cookbook>>>>
//Include and initialize the AJAX Toolkit javascript library
//
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
//Get the list of accounts that should be deleted.
//Use the $ObjectType merge field to indicate the type of record ids that are expected
var idsToDelete = {!GETRECORDIDS( $ObjectType.Contact )} ;
var deleteWarning = 'Are you sure you wish to delete '+ idsToDelete.length + ' contacts?';
if (idsToDelete.Length && (window.confirm(deleteWarning)))
{
sforce.connection.deleteIds(idsToDelete,function() { navigateToUrl(window.location.href);});
} else if (idsToDelete.length == 0){
alert("Please select the contacts you wish to delete.");
}
But when i click on the button, it is not doing anything at all. Could you please help?
Thanks
MSC
- msc7808
- June 25, 2009
- Like
- 0
- Continue reading or reply
Validation
I have defined a Master Detail relationship on 1 table
Table A (Master Table)
XYZ Hotel 123 Madison Avenue New York New York 10016
Table B (Child Table) Hotel Type
XYZ Hotel SPA Hotel
XYZ Hotel Boutique Hotel
ZYX Hotel Golf Hotel
I would like to implement Validation rules whereby onSave of new record for Hotel Type, the rule will check if the Type is already defined for this hotel and therefore warn the user. ex. if a user was to create a new Hotel Type for XYZ Hotel and by mistake selects Golf hotel again, it will not accept that entry and show the message to the user.
Can this be done?
Thanks
MSC
- msc7808
- June 24, 2009
- Like
- 0
- Continue reading or reply
Override Delete/Edit routine
Hey Guys,
I am quite new to the Salesforce. I am working on creating a test application. I need to implement a Override routine to the Delete so that the user can;t do hard delete of record but rather flag the record as deleted.
I found on the set up page that we can override the Delete button however I dont know what to do next. Could you please assist by posting or directing me to an example?
Thanks
Manpreet
- msc7808
- June 23, 2009
- Like
- 0
- Continue reading or reply
Create Custom Object
I have following test tables in my SQL server which I need to bring forward into the Salesforce.
1st Table: Chain
ChainCode char(2)
Description nvarchar(100)
2nd Table: Hotels
HotelDetails
HotelID Number Auto-Increment
ChainCode char(2) <-----------------------Master-Detail Relationship to Chain.
I was told to create Custom Objects in the Salesforce therefore Group these into seperate Apps etc. Could someone please provide in details how to achieve this? I am having bit trouble when creating 1st custom object Chain. I can specify the field as Text however how can I limit the user to only enter two digits as opposed to 80 Chars which is default limit.
Best Regards,
Manny
- msc7808
- January 24, 2009
- Like
- 0
- Continue reading or reply
Tutorials/Books
- msc7808
- January 20, 2009
- Like
- 0
- Continue reading or reply
Dynamically Populate Multi Pick
Thanks
Manny
- msc7808
- January 15, 2009
- Like
- 0
- Continue reading or reply
Dynamic Picklist
Manny
- msc7808
- January 15, 2009
- Like
- 0
- Continue reading or reply
Need Help
Hey Guys,
I have defined two custom objects as follows:
(1) Hotel Record Name: HotelName
(2) CustomContact Record Name: Full Name Sec Field Hotel: Lookup(Hotel)
I have Apex Code
CustomContact__c[] contacts = new CustomContact__c[0];
contacts.add(new CustomContact__c(Business_Title__c='test',TypeofContact__c='Hotel',Hotel__c=HotelName,Name='John Doe'));
I am getting an error:
A problem with the OnClick JavaScript for this button or link was encountered:
{faultcode:'soapenv:Client', faultstring:'System.StringException: Invalid id: Dummy Hotel Class.WSUpdates.InsertHotelContacts: line 39, column 115', }
Please advise what could be wrong.
THanks
Manny
- msc7808
- July 05, 2009
- Like
- 0
- Continue reading or reply
Auto Fill Recordname
Hey Guys, I am just curious as to if this can be done or not. I have created an Object HotelContacts with RecordName "Full Name". Also there are other fields defined such as Salutation, FirstName, MI and LastName. What i need to do is to have a user enter these fields and auto-fill Salutation based on the other fields.
Is this possible to do?
Thanks
Manny
- msc7808
- July 02, 2009
- Like
- 0
- Continue reading or reply
How to call .net web service from salesforce???
Hi To all,
How to call External(.net) webservice from Salesforce???
& how to use that webservices in APEX classes & triggers????
Thanks,
Krishna.
- Krishna_
- June 26, 2009
- Like
- 0
- Continue reading or reply
Override Delete/Edit routine
Hey Guys,
I am quite new to the Salesforce. I am working on creating a test application. I need to implement a Override routine to the Delete so that the user can;t do hard delete of record but rather flag the record as deleted.
I found on the set up page that we can override the Delete button however I dont know what to do next. Could you please assist by posting or directing me to an example?
Thanks
Manpreet
- msc7808
- June 23, 2009
- Like
- 0
- Continue reading or reply
Dynamic Picklist
Manny
- msc7808
- January 15, 2009
- Like
- 0
- Continue reading or reply