• Mohit Mohan
  • NEWBIE
  • 25 Points
  • Member since 2007

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies
I have the following trigger / @future callout which works terrific in the UI.

==============================================================
trigger afterInactivateUser on User (after update) {
 Set<Id> inactivatedParterUsers = new Set<Id>();

 for(Integer i = 0; i < Trigger.new.size(); i++){
  User oldUser = Trigger.old.get(i);
  User updatedUser = Trigger.new.get(i);
  if(updatedUser.ContactId != null && updatedUser.IsActive == false && oldUser.IsActive == true){
   inactivatedParterUsers.add(updatedUser.id);
  }
 }
 if(!inactivatedParterUsers.isEmpty()){
  PartnerUtils.createInactivateUserPartnerRequest(inactivatedParterUsers);
 }
}
==============================================================
==============================================================
public class PartnerUtils {
 @future
 public static void createInactivateUserPartnerRequest(Set<Id> ids){
  List<User> users = new List<User>([select id, ContactId from User where id in :ids]);
  List<MyCustomObject__c> requestList = new List<MyCustomObject__c>();
  MyCustomObject__c request = null;
  for(User user : users){
   request = new MyCustomObject__c();
   request.Contact__c = user.ContactId;
   requestList.add(request);
  }
  insert requestList;
 }

}
==============================================================

However, the following test throws a MIXED_DML_OPERATION when the @future createInactivateUserPartnerRequest() method tries to insert a non-User object:
==============================================================
@IsTest
private class PartnerUtilsTest {
private static testmethod void testAfterInactivateUserTrigger(){
User user = [select id from user where IsActive = true and ContactId != null limit 1];
user.IsActive = false;
update user;
}
}
==============================================================

Any ideas on a workaround that won't fail?
Hi,

  How to migrate Relationship into SFDC using Pervasive i.e., if I want to move Account - > Contact relationship from Legacy to SFDC

Folllowing happens when we use Data loader:-

IF its manual process what we do is

a.     Migrate Accounts

b.     Get the Account SFDC ID and Account Legacy ID export from SFDC

c.     Now before migrating Contact, we use above Account export to update Contact_To_Be_Migrated by looking up Account Legacy ID with Account SFDC ID

d.     So this would result in Contact_To_Be_Migrated to hold one more column of AccountSFDCID which would indicate that this contact need to be migrated under which SFDC Account

e.     Now we migrate the Contact with Account SFDC ID mapped to AccountID field of Contact

f.       So automatically the SFDC too will start showing the Relationship

Can anybody tell me that how should we carry out the process using Pervasive



Hi ,

Can anyone help me that how I can  Schedule daily/hourly batch   job using Pervasive tool for inserting Data in salesforce.com.

I am new in using Pervasive Tool and urgently want help in this regard. I need the process that what should I do so that there should be batch updates of data in salesforce.com on daily or hourly basis.

Please anyone provide the inputs



I want to make the custom page in salesforce.I also want the look and feel of the custom page as any other  pages we have in salesforce(Eg Account ,Contact).

Please help me how to start with the first step in making the custom page by the help of S-controls.

Regards
Mohit


Hi,

I am suppose to use Pervasive data migration tool in one of my project instead of Apex data loader.As I am new to this tool and also not aware how to use it .

Please provide me with the information about how to use the pervasive data migration tool.Please also provide me informaiton that How to install pervasive and integrate ie with Salesfoce.com .

Thanks
Hi ,

I am writing my first Apex -API program in .NET (C#).The program as follows:-

private void button1_Click(object sender, EventArgs e)
       {
           
           sForce.SforceService abc = new Jaggu.sForce.SforceService();
           sForce.Account objAccount = new Jaggu.sForce.Account();
           //Set several properties

           // Invoke the login call and save results in LoginResult

          // sForce.Proxy = System.Net.WebProxy.GetDefaultProxy();
           sForce.LoginResult lr = abc.login("******", "");
           // Reset the SOAP endpoint to the returned server URL

           abc.Url = lr.serverUrl;// "https://www.salesforce.com/services/login.jsp";

           // Create a new session header object
           // Add the session ID returned from the login

           abc.SessionHeaderValue = new sForce.SessionHeader();
           abc.SessionHeaderValue.sessionId = lr.sessionId;
           sForce.GetUserInfoResult userInfo = lr.userInfo;
           objAccount.Name = "John Abhraham ";
           objAccount.Description = "Happy World";

           sForce.sObject[] records = new sForce.sObject[]
{
   objAccount
};

           sForce.SaveResult[] saveResults = abc.create(records);
           String newID = saveResults[0].id;
           MessageBox.Show(newID);

note :-sForce.LoginResult lr = abc.login("******", "");.
I have not given my login Id and password .Anybody can put there credencials.


The Error which I am geeting is :-

"The remote server returned an error: (407) Proxy Authentication Required"


I think ,I am  behind a firewall or proxy server for my  internet access.Please provide me with the another way  so that i can hit the Salesforce .


I have tried for evey possibility.Please help me in this regard......???

Regards
Mohit Mohan
Hi ,

Can you please provide me the information about how the approval process work and how It is different from workflows.

Thanks
Mohit Mohan

Greetings! I am new to the SalesForce world. I am starting up a small project that will use the Web Services API.  So far I've had good luck with accessing the service, pulling data, etc. 

 

Now I've dabbled with creating a new record.  I have it working but I was hoping that someone could look at my code sample and tell me if this is most efficient way.  I fear that I have over-complicated things.

 

My SF object is a simple table (is this even the right word in the salesforce world??) called test with just one field called Name.  Standard stuff.  So to create/insert I am doing the following in c#:

 

        Test__c[] newStuff = new Test__c[1];

        newStuff[0] = new Test__c();
        newStuff[0].Name = "My Test Name";

        String[] createdItemIds = new String[10];
        SaveResult[] sr = binding.create(newStuff);

        for (int i=0;i<sr.Length;i++) {

            if (sr[i].success) {

                Response.Write("<hr/>" + sr[i].id.ToString() + "<hr/>");
                createdItemIds[i] = sr[i].id;

            }

        }

 

 

I built this from some c# sample code that I found on here.  Like I said everything works but the sample code I found was for inserting multiple records at once.  I am curious if there is a cleaner, more direct way to insert a SINGLE record and get the new unique ID back from the webservice.

 

Thanks in advance for any tips or advice!

 

- Jasper

 

 

I have the following trigger / @future callout which works terrific in the UI.

==============================================================
trigger afterInactivateUser on User (after update) {
 Set<Id> inactivatedParterUsers = new Set<Id>();

 for(Integer i = 0; i < Trigger.new.size(); i++){
  User oldUser = Trigger.old.get(i);
  User updatedUser = Trigger.new.get(i);
  if(updatedUser.ContactId != null && updatedUser.IsActive == false && oldUser.IsActive == true){
   inactivatedParterUsers.add(updatedUser.id);
  }
 }
 if(!inactivatedParterUsers.isEmpty()){
  PartnerUtils.createInactivateUserPartnerRequest(inactivatedParterUsers);
 }
}
==============================================================
==============================================================
public class PartnerUtils {
 @future
 public static void createInactivateUserPartnerRequest(Set<Id> ids){
  List<User> users = new List<User>([select id, ContactId from User where id in :ids]);
  List<MyCustomObject__c> requestList = new List<MyCustomObject__c>();
  MyCustomObject__c request = null;
  for(User user : users){
   request = new MyCustomObject__c();
   request.Contact__c = user.ContactId;
   requestList.add(request);
  }
  insert requestList;
 }

}
==============================================================

However, the following test throws a MIXED_DML_OPERATION when the @future createInactivateUserPartnerRequest() method tries to insert a non-User object:
==============================================================
@IsTest
private class PartnerUtilsTest {
private static testmethod void testAfterInactivateUserTrigger(){
User user = [select id from user where IsActive = true and ContactId != null limit 1];
user.IsActive = false;
update user;
}
}
==============================================================

Any ideas on a workaround that won't fail?