• Michael Snow
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 21
    Replies
Code:
trigger EndSSUAccessWhenContactIsSetToFormerUser on Contact bulk (after update) 
{
 Set<Id> lConIds = new Set<Id>();
 for (Contact c : Trigger.new)
 {
  lConIds.add(c.Id);
 }
 List<SelfServiceUser> lSSUs = new List<SelfServiceUser>([select Id, IsActive, ContactId from SelfServiceUser where ContactId in :lConIds]);
 Map<Id,SelfServiceUser> lSelfServiceUsers = new Map<Id,SelfServiceUser>();
 for(SelfServiceUser s: lSSUs)
 {
  lSelfServiceUsers.put(s.ContactId,s);
 }
 
 List<SelfServiceUser> lSelfServiceUserUpdates = new List<SelfServiceUser>();
 for (Contact c : Trigger.new)
 {
  SelfServiceUser s = lSelfServiceUsers.get(c.Id);
  if(c.OMG_ContactType__c == 'Former User' && s != null && s.IsActive)
  {
   s.IsActive = false;
   lSelfServiceUserUpdates.add(s);
   if(lSelfServiceUserUpdates.size() == 200) 
   {
       //update lSelfServiceUsersUpdates;
       lSelfServiceUserUpdates.clear();   
   }
  }
 }
 if(lSelfServiceUserUpdates.size() > 0)
 {
  //update lSelfServiceUsersUpdates;
 }
}

 
We have a custom field that determines the status of a contact.  If the contact is set to a "Former User" we would like to remove access to the case self service portal.  However, I am having trouble updating the SelfServiceUser object inside of my after trigger.  Also, any suggestions on how to improve efficiency of this code would be greatly appreciated.

Hi,
 
I am writing a new class (OurContact) that extends the Contact class.
 
When I try to type cast Cotnact object to OurContact object, I get ClassCastException. Please suggest what can be done.
 
Thanks,
Rohit M.
 
  • March 04, 2008
  • Like
  • 0
I am trying to create new case with couple of pre-populated fields.  I tried custom link that works only as a detail button on  a Case.
 
I would like to create a list button that overrides NEW button on Case Home Page.
 
Could  somebody share s-control that will help me or give me some pointers to accomplish this.
 
Thankyou very much.
The formula I am using is listed below.  While it works, it is limiting due to the need to hard code the DATE (2009,06,30). 
 
Does anyone know how I can get around harding coding the date? 
If not, how can recode the formula to look at two years, rather than one?  (I think it should be a case function but cannot figure it out)
 
(DATE(2009,06,30) - ( Projected_Start_Date__c )) /365 * (  Annual_Paid_Claims__c )
(DATE(2010,06,30) - ( Projected_Start_Date__c )) /365 * (  Annual_Paid_Claims__c )
I'm trying to integrate salesforce with our legacy DB.  I have an Order__c with Order_Products__c Master Detail relationship.  When I am building my soap message how do I reference the detail fields?  I'm using Java to do the integration.  Anyone have an sample code or is this possible?  I assume it will be something similar to Order__c.fieldName  Any guidance?

Is there any way to override the behavior of the Save button on a standard object (i.e., Opportunity)?  Basically we were planning on building an S-control that looks to see if an Opportunity (for a particular product type) is closed/won and if it is update a Boolean field on the Opportunity.  Unfortunately it does not look like it’s possible to override or hide the standard Save button.   Can anyone think of a work around other than outbound messaging to a hosted solution that will update the record via the API?  We are using SFDC Enterprise Edition.

Thank you,
Scott

Code: My issue is this. I've created a custom field on my 'pelkins@parallels.com' account. And, I'm using the API to upsert data. The call executes and the results are returned without error. Per the UpsertResults returned, every row has failed to upsert with the message in the Subject line above. So, my question is WHY— I have refreshed my wsdl via XML download. I see the property in the API and via my login in SalesForce, but for some reason, the custom field is not recognized. Whassup–
Hi,
 
One of the business requirements when merging accounts of different record types is to make sure that a certain record type remains the active record. 
 
Ex.  Account 1 has rec type 1
       Account 2 has rec type 2
 
The requirement is to make sure that account 2 will remain active after the merge.  We can not enforce this rule in salesforce in case the user makes a mistake and choose account 1 as the master record.
 
What we did is to correct the merge outside salesforce and update account 1 with the attributes of account 2.  The problem is one of the custom fields in the account object is defined as unique and I get a duplicate value error when doing the update.  
 
Here are my options:
1.  Is there a way to trigger a physical delete of  the logically deleted record so I won't get the duplicate value error?  I tried to clear the recycle bin but the logically deleted record is still in the table.
 
2.  Can we limit validation for uniqueness to active records only?  What's an efficient way of doing this?
 
Thanks in advance for any input.
  • October 02, 2007
  • Like
  • 0
Hey Everyone,

I have created 2 formula fields. One field called Today determines the current day of the week (monday, tuesday, etc...), the other field called Run Day will evaluate if the Today field is equal to a picklist field called Delivery Day. If so it will say Production Run Today, if not No Production Run Today.

For some reason the 2nd formula field doesnt seem to work correctly. Can anyone help out? My code is below:

IF(ISPICKVAL(Delivery_Day__c,Today__c),"Production Run Today", "No Production Run Today")


Thanks,
Rich
  • September 30, 2007
  • Like
  • 0
I have a JavaScript variable I'm setting to create a lead from a contact. Some of the fields contain carriage returns. As you can imagine, JavaScript does not like this.

This is my example variable:

lead.set("Description", "{!Contact.Description}");

How is the best way to clean up this variable so it doesn't show up with carriage retruns?

lead.set("Description", "This is my test example

test

test");




-Scott
Hi,
 
I need to write a SOQL that can return the following result.
 
I have two objects Account and Cards. Cards has a lookup field to the Account object, but it is not in Parent-Child relationship.
 
I need to get a list of All account names that has atleast one record in the Cards Object. I cannot create a summary field due to other constriants.
 
Any feedback on this is greatly appreciated. Thanks
Ambili  
  • September 26, 2007
  • Like
  • 0
Please look at the 2 lines bellow and help me to understand why:
 
- value of the _name in first line = "Brett's Industrial Account"
- value of the _name in the second line = "Brett"
 
How to fix this one?
I will really appriciate your help.
 
============================================================
alert(_name);
output = "<input id=btn1 type=button name=btn1 onclick=\"" + fn + "\" value='" + _name + "'>";
I'm struggling a bit to write a simple join query using the 'relationship query' syntax of SOQL.
Could someone please post any ideas about how to obtain the following info in a single SOQL command.
Here is the pseudo code:
Get all contacts for accounts that have assets with product='X'
I know I can iterate through all assets and grab each account one at a time but I thought there must be a better way.

I've tried the following which throws SOQL syntax errors:

Select a.Id, a.AccountNumber, a.Name, (SELECT id,lastname,firstname,email FROM Contacts), (SELECT status, Product2Id from Assets ) from Account a where a.Assets.Product2Id = '01t40000000bgY7AAI'


  • September 21, 2007
  • Like
  • 0
I'm a newbie in this Salesfore Java developement... i just want to write a very simple Java program that do some salesforce queries like inserting, upserting data... like the quickstartJava sample...
 
My current set up is:
Tomcat 4.1
Java SDK 1.5
Axis 1.4
 
When i tried to convert the enterprise.wsdl from my salesforce account to java classes, i got a list of exception errors... can someone help me understand what is going on?  Many thanks!
 
Code:
java org.apache.axis.wsdl.WSDL2Java enterprise.wsdl
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError: javax.wsdl.Definition

        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.class$(JavaGenerator
Factory.java:68)
        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.addDefinitionGenerat
ors(JavaGeneratorFactory.java:179)
        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.addGenerators(JavaGe
neratorFactory.java:133)
        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.<init>(JavaGenerator
Factory.java:111)
        at org.apache.axis.wsdl.toJava.Emitter.<init>(Emitter.java:159)
        at org.apache.axis.wsdl.WSDL2Java.createParser(WSDL2Java.java:209)
        at org.apache.axis.wsdl.gen.WSDL2.<init>(WSDL2.java:96)
        at org.apache.axis.wsdl.WSDL2Java.<init>(WSDL2Java.java:194)
        at org.apache.axis.wsdl.WSDL2Java.main(WSDL2Java.java:371)

 
  • September 19, 2007
  • Like
  • 0
Hi All,
 
we have a requirement in which we are creating contract using API methods create. we are facing issue
in setting Date. I need to populate the date in this format with time stamp also..20070914T-0102. i need to move this value in to Start Date of contract. please help me how to do this..
 
Thanks.
UDAYA