Announcement

Collapse

Information Needed

See more
See less

Problems coding triggers for Salesforce integration

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems coding triggers for Salesforce integration

    1. For my WaterGrass application, Iím writing a trigger on the Transaction object that will search for the contact and account, and avoid duplicates. (Yes, I need my own trigger.) But I find that when I enter a payment via the Virtual Terminal or by an online form, the first and last name donít get entered into the Transaction.firstname and Transaction.lastname and so I canít use them. What happens to them? I know I can get them from the Data object, but really donít want to have to do that, because I only want to create an Opportunity if the Transaction record is created. How can I access the raw first and lastname?
    2. Youíve created an Opportunity Record Type C&P Online. I would like to use it for the opportunities I create. But although I can do this manually, when I try it in apex I get: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: id value not valid for the users profile: 012d0000000sfyRAAQ: [RecordTypeId]. Iím a Sysadmin. Is it possible that you have restricted access to the C&P Online record type so that I canít create new opportunities of this record type?


    Baird Straughan

  • #2
    Good day Baird,

    Replies to your questions:

    1. For my WaterGrass application, Iím writing a trigger on the Transaction object that will search for the contact and account, and avoid duplicates. (Yes, I need my own trigger.) But I find that when I enter a payment via the Virtual Terminal or by an online form, the first and last name donít get entered into the Transaction.firstname and Transaction.lastname and so I canít use them. What happens to them? I know I can get them from the Data object, but really donít want to have to do that, because I only want to create an Opportunity if the Transaction record is created. How can I access the raw first and lastname?

    Reply: The fields associated with the information are the following:

    • CnP_PaaS__CnP_Transaction__c.Contact__r.Firstname
    • CnP_PaaS__CnP_Transaction__c.Contact__r.lastname
    • and CnP_PaaS__CnP_Transaction__c.Contact__r.email


    2. Youíve created an Opportunity Record Type C&P Online. I would like to use it for the opportunities I create. But although I can do this manually, when I try it in apex I get: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: id value not valid for the users profile: 012d0000000sfyRAAQ: [RecordTypeId]. Iím a Sysadmin. Is it possible that you have restricted access to the C&P Online record type so that I canít create new opportunities of this record type?

    Reply: RecordType ID field is not updatable. We can't restrict record types and we have no restrictions.

    Hope that answers the questions.
    Regards,
    Click & Pledge Support Department

    On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

    Join us @ the educational webinars: https://clickandpledge.com/webinars/
    Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
    Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

    Comment


    • #3
      Further clarification

      But since I'm writing my own trigger, I've disabled the trigger that creates a new contact for the transaction. So no contact is created. So the Contact__r.Firstname probably isn't populated, correct? Or do you populate those even if you don't create/identify a contact. Is the name information included anywhere else in the Transaction object?

      Originally posted by Support.Department View Post
      Good day Baird,

      Replies to your questions:

      1. For my WaterGrass application, Iím writing a trigger on the Transaction object that will search for the contact and account, and avoid duplicates. (Yes, I need my own trigger.) But I find that when I enter a payment via the Virtual Terminal or by an online form, the first and last name donít get entered into the Transaction.firstname and Transaction.lastname and so I canít use them. What happens to them? I know I can get them from the Data object, but really donít want to have to do that, because I only want to create an Opportunity if the Transaction record is created. How can I access the raw first and lastname?

      Reply: The fields associated with the information are the following:

      • CnP_PaaS__CnP_Transaction__c.Contact__r.Firstname
      • CnP_PaaS__CnP_Transaction__c.Contact__r.lastname
      • and CnP_PaaS__CnP_Transaction__c.Contact__r.email


      2. Youíve created an Opportunity Record Type C&P Online. I would like to use it for the opportunities I create. But although I can do this manually, when I try it in apex I get: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: id value not valid for the users profile: 012d0000000sfyRAAQ: [RecordTypeId]. Iím a Sysadmin. Is it possible that you have restricted access to the C&P Online record type so that I canít create new opportunities of this record type?

      Reply: RecordType ID field is not updatable. We can't restrict record types and we have no restrictions.

      Hope that answers the questions.

      Comment


      • #4
        Baird,

        We dont have any trigger that works on contact (to disable). We only have one trigger on the C&P data object which updates various objects according to the C&P Settings.

        The only case that contact__r.fistname will not create is when a transaction does have any contact, meaning it is not associated with any contact and as a result it will be empty.

        The main field in the transaction object regarding your question is: CnP_PaaS__CnP_Transaction__c.CnP_PaaS__Contact__c.
        Regards,
        Click & Pledge Support Department

        On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

        Join us @ the educational webinars: https://clickandpledge.com/webinars/
        Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
        Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

        Comment


        • #5
          Is it possible to set the c&P data object trigger to update the CnP_PaaS__CnP_Transaction__c.firstname and .lastname fields, in all cases? I would like to be able to use those.

          Because I'm writing my own trigger off the CnP_Transaction object, I need the information there. The trigger creates the opportunity based on campaign and some tracker information, and finds the contact and account based on an algorithm that I prefer to yours. I'm guessing there are probably a number of developers like me who would create their own triggers off the Transaction object, if it had the information needed. And it seems like it would probably only be two lines of code to insert the firstname and lastname when you parse the Data object. Am I right?

          Comment

          Working...
          X