• Mascotte
  • NEWBIE
  • 0 Points
  • Member since 2006

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

For my personnel needs I have done generic "update" and "delete" functions.

Code:
public string Create(string type, Hashtable fields)
{
  try
  {
    Assembly A = Assembly.GetExecutingAssembly();
    Type[] Ts = A.GetExportedTypes();
    Type T = null;

    // Type
    object ob = null;
    foreach (Type t in Ts)
    if (t.Name == type)
    {
      T = t;
      break;
    }
    if (T == null)
      return null;

    // Object
    ob = Activator.CreateInstance(T);
    IDictionaryEnumerator Enum = fields.GetEnumerator();
    while (Enum.MoveNext())
    if (T.GetField(Enum.Key.ToString()) != null && Enum.Value != null)
    {
      FieldInfo info = T.GetField(Enum.Key.ToString());
      info.SetValue(ob, Enum.Value);
    }
    SaveResult[] Result = S.create(new sObject[]{(sObject)ob});
    if (Result[0].success == true)
      return Result[0].id;
    else {return null;}
  }
  catch (Exception ex){return null;}


I hope it will help you !
Just past the type of the object to create (ex: "Lead") and a HashTable
wish associates FieldName and Value (ex: "City" / "New York");
It manage fieldsToNull

Please tell me what you think about it !
Problem when working with sforce API:
INVALID_SESSION_ID found in SessionHeader

Here is the code I use to login:

Code:
LoginResult loginResult = S.login(login, pass);
S.SessionHeaderValue = new SessionHeader();
S.SessionHeaderValue.sessionId = loginResult.sessionId;
S.Url = loginResult.serverUrl;

 Any news concerning this problem ?
The Support Service couldn't resolve my problem :s

Hi !

I create an object and specify a particular Field.
For exemple I create an Opportunity, specifying the description field.
The object is well created and the description field is set to a value.

When I update this object, I can change the value of the field without any problem.
But if the new value is null (typicaly an empty Textbox), the field is not set to null on update,
containing the same value as before the update !!!

I tried this:
if (DescriptionBox.Text.Length == 0)
    MyOpportunity = null;

Doesn't work :(

Any idea about my problem ?
Thank you in advance.
Matthias.
Hi,

For my personnel needs I have done generic "update" and "delete" functions.

Code:
public string Create(string type, Hashtable fields)
{
  try
  {
    Assembly A = Assembly.GetExecutingAssembly();
    Type[] Ts = A.GetExportedTypes();
    Type T = null;

    // Type
    object ob = null;
    foreach (Type t in Ts)
    if (t.Name == type)
    {
      T = t;
      break;
    }
    if (T == null)
      return null;

    // Object
    ob = Activator.CreateInstance(T);
    IDictionaryEnumerator Enum = fields.GetEnumerator();
    while (Enum.MoveNext())
    if (T.GetField(Enum.Key.ToString()) != null && Enum.Value != null)
    {
      FieldInfo info = T.GetField(Enum.Key.ToString());
      info.SetValue(ob, Enum.Value);
    }
    SaveResult[] Result = S.create(new sObject[]{(sObject)ob});
    if (Result[0].success == true)
      return Result[0].id;
    else {return null;}
  }
  catch (Exception ex){return null;}


I hope it will help you !
Just past the type of the object to create (ex: "Lead") and a HashTable
wish associates FieldName and Value (ex: "City" / "New York");
It manage fieldsToNull

Please tell me what you think about it !
Problem when working with sforce API:
INVALID_SESSION_ID found in SessionHeader

Here is the code I use to login:

Code:
LoginResult loginResult = S.login(login, pass);
S.SessionHeaderValue = new SessionHeader();
S.SessionHeaderValue.sessionId = loginResult.sessionId;
S.Url = loginResult.serverUrl;

 Any news concerning this problem ?
The Support Service couldn't resolve my problem :s

hello,
 
 my problem is when i am going to create new lead in my application it throws the  exception :INVALID_SESSION_ID: INVALID SESSION ID FOUND IN SESSIONHEADER
 
is there any solution on this ?
 
plz reply
 
 
  • June 15, 2006
  • Like
  • 0
Hi !

I create an object and specify a particular Field.
For exemple I create an Opportunity, specifying the description field.
The object is well created and the description field is set to a value.

When I update this object, I can change the value of the field without any problem.
But if the new value is null (typicaly an empty Textbox), the field is not set to null on update,
containing the same value as before the update !!!

I tried this:
if (DescriptionBox.Text.Length == 0)
    MyOpportunity = null;

Doesn't work :(

Any idea about my problem ?
Thank you in advance.
Matthias.
Hi
I am using salesforce api for one of my Biz talk integration project .
I want to fire some query with multiple tables say account ,contact etc and with some where condition like urn value null .
Can any one tell me how can i do this as Query method does not support joins .
Please reply as soon as possible if any one knows solution for this
 
Thanks in Advance
Sachin