• sHoller
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

Hi All,

 

I'm trying to have a trigger run when I create a new Tickets object.  When you create a Tickets object you define a related Contact object, and I'd like to change the value of a field (ticketsTest__c) of the Contact.

 

This is all done on the front-end, and only one Tickets obj will ever be created at a time so I didn't use a list.  I'm sure that's bad form, just a heads-up.  I'm trying to select the Contact record where the ID is equal to the related Contact object ID of the newly created Tickets obj.  In my test class I create a Contact and set the value of ticketsTest__c to 'blah', and the system.assert result says that the actual result of the field is still 'blah' rather than 'testPopulated'.  Also, I'm getting a "Save error: unexpected token: 'tixID'".  Can anyone please help?  It would be much appreciated.

 

Here's the code I've got right now for the trigger:

 

trigger TicketCreatePopulateContact on Tickets__c (before insert, before update) {

 

for(Tickets__c ticket: Trigger.New) {

    Id tixID = ticket.Contact__c;

    Contact s = [select Id, ticketsTest__c from Contact where Id = tixID];

    s.ticketsTest__c = 'testPopulated';

    update s;

    }

}

Hello all, I'm not looking for anyone to do my work or anything very specific, but a point in the right direction for what I should read up on.  I just started a new job where I have to use salesforce and am not familiar with it at all, but I have been programming in c and java for a while, and am somewhat comfortable with sql and databases.

 

Anyways, I'm looking to create new custom objects (Hits) with unique identifiers "t-ID" and a small number of other fields.  I want each new object to be linked to the Contact in the database with the matching "t-ID" field, and then I would like to populate the Hits objects fields with data that I draw from their linked Contact.  It looks like doing this through salesforce's point and click interface would be very convoluted- would it be smarter to read up on using the API, or is there some better way to manipulate the database directly? I have some pseudo-code written out, I just don't know how to run the logic in salesforce. 

 

I appreciate any advice that can be given, thanks

Hi All,

 

I'm trying to have a trigger run when I create a new Tickets object.  When you create a Tickets object you define a related Contact object, and I'd like to change the value of a field (ticketsTest__c) of the Contact.

 

This is all done on the front-end, and only one Tickets obj will ever be created at a time so I didn't use a list.  I'm sure that's bad form, just a heads-up.  I'm trying to select the Contact record where the ID is equal to the related Contact object ID of the newly created Tickets obj.  In my test class I create a Contact and set the value of ticketsTest__c to 'blah', and the system.assert result says that the actual result of the field is still 'blah' rather than 'testPopulated'.  Also, I'm getting a "Save error: unexpected token: 'tixID'".  Can anyone please help?  It would be much appreciated.

 

Here's the code I've got right now for the trigger:

 

trigger TicketCreatePopulateContact on Tickets__c (before insert, before update) {

 

for(Tickets__c ticket: Trigger.New) {

    Id tixID = ticket.Contact__c;

    Contact s = [select Id, ticketsTest__c from Contact where Id = tixID];

    s.ticketsTest__c = 'testPopulated';

    update s;

    }

}

Hi,

 

I'm trying to implement the feature 'Web to Case'. I've a form published in my web site and when the user submits the form its creating a case in my Sanbox. But since the user is not a contact in Salesforce, contact email and contact phone fields are not getting populated. I want to have the email field populated so that when I update the case it will trigger an email to the end user who logged the case online.

 

How can I pass the email and phone number from the form (from web site) to an Apex trigger to create the contact before creating a Case. I'm not sure whether this is possible. If that is possible, please guide me to accomplish it. Also let me know if there is any other way to create a Contact on the fly before creating a Case [through Web to Case].

 

Thanks