• tns
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 13
    Replies

Am new to Apex and just  starting to learn it, so I would appreciate any help here.

 

I was informed that I should include a few Contact creations (with Ing user id field populated), and deletions of Contacts that are created by this class

 

Can anyone help me write a Test Class for this simple Apex trigger? The trigger restricts all profiles (except the Sys Admin one), from deleting Contacts IF the record contains an integer > 0 in the Ing User ID custom field.

 

trigger CheckFieldValues on Contact (before delete) 
{
        if(UserInfo.getProfileId()=='00e50000000sCkdAAE')
        {
            System.debug('User Profile Id--'+UserInfo.getProfileId());
        }
         else
         {
             for (Contact c : Trigger.old)
             {
 
                if (c.ING_USER_ID__c > 0 )
                {
                    c.addError('**This Contact record contains a unique Ingenuity User ID and cannot be deleted. Deletion would have a detrimental impact on data integration processes**');
                }
             }
            
         }
        
}

Without using Record Types or Apex or Visual Force, does anyone have any ideas on how to restrict non-admin users from deleting Contacts that contain a value in a custom field that holds a Unique Id from an external system on the Contact record? It woudl be OK for users to delete a Contact that does not contain this unique id.

I'm using OpenSSO to authenticate with my SF developer account.  According tothe SAML Validator my SAML response is good.  This is supported by the Login History, which shows a successful login for my user via SAML Idp Initiated SSO.  Still, instead of getting directed into SF after login, I get redirected to the following error page:

 


Invalid Page Redirection
The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your salesforce.com Administrator for assistance.

Click here to return to the previous page.


Here's the SAML Response:

 

<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Destination="https://login.salesforce.com/?saml=02HKiPoin4YWIEZVhRxAotsxXTE8snvZkcfnHVUoabFTp6uOXs180wMbR2" ID="s284c6b267aec8be2c66edcc163f7cf5a492522909" IssueInstant="2010-03-07T01:21:18Z" Version="2.0"> <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"> http://www.abazaindustries.com:8080/opensso_abaza</saml:Issuer> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI="#s284c6b267aec8be2c66edcc163f7cf5a492522909"> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue>bbdtFNmHOCmOJDxBKRPBQMGWx/c=</DigestValue> </Reference> </SignedInfo> <SignatureValue> NyXQjGHDh7CEcmBaY5G8EcbP3nsALGkCR/dls5wy72hhvN4+EJlvD/fQuSIjxPrHl/nJJTXQJwwJ rJN6+8CBqBXPM+OAbfRzSY1MryIgi2gGxZgvYtve0VTIsJn+D86Uh6nJEbDODE9qlUEF+hpsZwgp qTehm8e0BzCRU8d0yNs=</SignatureValue> <KeyInfo> <X509Data> <X509Certificate> MIICQDCCAakCBEeNB0swDQYJKoZIhvcNAQEEBQAwZzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNh bGlmb3JuaWExFDASBgNVBAcTC1NhbnRhIENsYXJhMQwwCgYDVQQKEwNTdW4xEDAOBgNVBAsTB09w ZW5TU08xDTALBgNVBAMTBHRlc3QwHhcNMDgwMTE1MTkxOTM5WhcNMTgwMTEyMTkxOTM5WjBnMQsw CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEUMBIGA1UEBxMLU2FudGEgQ2xhcmExDDAK BgNVBAoTA1N1bjEQMA4GA1UECxMHT3BlblNTTzENMAsGA1UEAxMEdGVzdDCBnzANBgkqhkiG9w0B AQEFAAOBjQAwgYkCgYEArSQc/U75GB2AtKhbGS5piiLkmJzqEsp64rDxbMJ+xDrye0EN/q1U5Of+ RkDsaN/igkAvV1cuXEgTL6RlafFPcUX7QxDhZBhsYF9pbwtMzi4A4su9hnxIhURebGEmxKW9qJNY Js0Vo5+IgjxuEWnjnnVgHTs1+mq5QYTA7E6ZyL8CAwEAATANBgkqhkiG9w0BAQQFAAOBgQB3Pw/U QzPKTPTYi9upbFXlrAKMwtFf2OW4yvGWWvlcwcNSZJmTJ8ARvVYOMEVNbsT4OFcfu2/PeYoAdiDA cGy/F2Zuj8XJJpuQRSE6PtQqBuDEHjjmOQJ0rV/r8mO1ZCtHRhpZ5zYRjhRC9eCbjx9VrFax0JDC /FfwWigmrW0Y0Q==</X509Certificate> </X509Data> </KeyInfo> </Signature> <samlp:Status> <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"> </samlp:StatusCode> </samlp:Status> <saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="s26d010fb96c415e8dd239c664b62a95b62ad186c3" IssueInstant="2010-03-07T01:21:18Z" Version="2.0"> <saml:Issuer> http://www.abazaindustries.com:8080/opensso_abaza</saml:Issuer> <saml:Subject> <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" NameQualifier="http://www.abazaindustries.com:8080/opensso_abaza" SPNameQualifier="https://saml.salesforce.com"> xYNogS2tyRrH1DdZ1ASUD5BJZWlC</saml:NameID> <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"> <saml:SubjectConfirmationData NotOnOrAfter="2010-03-07T01:31:18Z" Recipient="https://login.salesforce.com/?saml=02HKiPoin4YWIEZVhRxAotsxXTE8snvZkcfnHVUoabFTp6uOXs180wMbR2" /> </saml:SubjectConfirmation> </saml:Subject> <saml:Conditions NotBefore="2010-03-07T01:11:18Z" NotOnOrAfter="2010-03-07T01:31:18Z"> <saml:AudienceRestriction> <saml:Audience>https://saml.salesforce.com</saml:Audience> </saml:AudienceRestriction> </saml:Conditions> <saml:AuthnStatement AuthnInstant="2010-03-07T01:21:18Z" SessionIndex="s2632afd2c7d9eee1430c180dbc8ffc4e1891c3b01"> <saml:AuthnContext> <saml:AuthnContextClassRef> urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef> </saml:AuthnContext> </saml:AuthnStatement> <saml:AttributeStatement> <saml:Attribute Name="ATTR_PHONE"> <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">555-555-5555</saml:AttributeValue> </saml:Attribute> </saml:AttributeStatement> </saml:Assertion> </samlp:Response>

 

 

I picked up the following Tip during a SFDC presentation and it works great on the Contact record. It creates a button on the Contact object, which when clicked, creates an activity in the Contact record and sets up a reminder task in 2 days.

I need to modify it to do the same on a Case object. Can anyone help me modify the code so that it does the same in a Case, i.e. creates an activity that a VM was left, and creating a reminder task when clicked? 

Code is at the end of the next section.

Need: Track all activities to contacts within Salesforce and save time by having one click logging of left voicemails

Business Case: Sales reps can quickly log voicemail calls and receive a reminder task a few days later to follow up on the voicemail.

Business Value: Make more calls, improve productivity in high call volume type environments

Left Voicemail Custom button instructions

To set 1 custom buttons on the contact record – LVM

select Setup| Appsetup | Customize | Contacts | Custom Buttons and Links | select new custom button

Create a button label name (LVM) in the display type select the Detail page button option

select behavior type - Display in existing window without sidebar or header

select content source – URL

 

add the Code: (modify the code to fit your instance)

/00T/e?followup=1&title=Call&retURL=%2F{!Contact.Id}&who_id={!Contact.Id}&what_id={!Account.Id}&tsk5=LVM&tsk6=Left+a+voicemail+for+{!Contact.Name}

&tsk5_fu=FU+VM+w+{!Contact.Name}+fr+{!Account.Name}&tsk4_fu={!TODAY()+2}&save=x

I created a custom field in Opportunity Products and set the formula to capture the unique ID of the Product line item when it is added to an Opportunity. When this Opportunity is cloned the following year (with the Product line items included), I would like this pre-captured ID to come through as is. Currently, when I clone the Opp with Pro, the custom field gets populated with the unique ID of the new product line item.... because all I have in my formula field is 'Id'. What can I add to this in the formula to make it keep the original value. 
When Lead is received with a checkbox marked (and will NOT be converted), can a Contact checkbox field be updated?
I was hoping that SFDC would add time based rule evaluation to the workflow capabilities.  That is, to run workflow rules without requiring the record to be modified first to trigger the rule.
 
My example is we allow some accounts be have a protected status as long as they have certain activity in a certain time period.  I've created the field that shows the days since said qualified activity occured, I have a workflow that will change the protected status based on the value in that qualified activity age field.
 
However, the rule only runs when someone modifies the account, so accounts can be falsely protected simply by not editing them.
 
I'm trying to find a way to make this rule run periodically without the modification.
 
Any suggestions?
 
Thanks,
 
Michael