• Romeo Ngo 1
  • NEWBIE
  • 135 Points
  • Member since 2015

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 12
    Replies
I have a requirement to create a validation rule to prevent transferring of records outside of a role.  I would like to allow users of a role to transfer objects owned by users in their role.  Any users outside of their role would not have permission to transfer records.  

Currently, our security is set to private and we enable view access to all accounts,leads,opportunity objects.  We have in place sharing rules per object per role, that give access to users within their respective role to edit those objects.  People outside that immediate role, do not have access to edit those objects.

The solution provides this : 

Mary in Role A
Joe in Role A
Bob in Role B

Mary can transfer an account that Joe owns into her name, but cannot transfer an account that Bob owns.  Bob cannot transfer Mary or Joe's account into his name.  

Is there a formula to use for a validation rule to only allow transferring objects based on roles as described in the example above?

Thanks!
Hi,
I am writing a before insert trigger that updates a field on the account whenever an attachment is added but only if the person adding the attachment is not the owner.  I try to select the owner of the associated account based on the attachment.parentid but it doesn't return any rows.  I tried to hardcode the parentid and it still doesn't return any rows.  The row is definitely there because I can query it and it does return a row.  Why does it not return the row.  Below are the trigger definition and the test class.  Thank you.
trigger AttachmentTrigger on Attachment (before insert) {
	List<Account> accountList = new List<Account>();

   Set<Id> accIds = new Set<Id>(); 
     for(Attachment att : trigger.New){
         //Check if added attachment is related to Account or not
         if(att.ParentId.getSobjectType() == Account.SobjectType){
      	Account a	= [select id,OwnerId from account where id = '001M000000Y2Rbx']; // :att.ParentId];
      	if (a.OwnerId != att.OwnerId)
              accIds.add(att.ParentId);}

    }
    accountList = [select id, has_Attachment__c from Account where id in :accIds];
    if(accountList!=null && accountList.size()>0){
        for(Account acc : accountList){
            acc.has_Attachment__c = true; 
        }
        update accountList;
    }         
	

}
private class TestAttachmentTrigger {

    static testMethod void myUnitTest() {
//    	Account[] a = [Select Id,name from account where Id = '001M000000Y2Rbx'];
    	User u2 = [select id from User where alias='administrator']; 
    	system.runAs(u2){
    	Blob body;
    	body = Blob.valueOf('test');
    	Attachment Attach = new Attachment();
    	Attach.ParentId = '001MxyzbwY2Rbx';  //id of an existing account
    	Attach.OwnerId = u2.Id;
    	Attach.Name = 'newattach';
    	Attach.Body = body;
    	insert Attach;
    	}

    }
}



 
  • February 09, 2015
  • Like
  • 0

if my expense type is (picklist) "office rent"  , then 10% on  the expense field be displayed in another custom field TDA.

using formula as a data type can any one tell me the logic for this?

Thanks in advance

I am trying write a formual that uses if and AND statments.  the logic I am trying to write is

IF(RFP_Flight_Date__c > today (), ( Days_Remaining_in_RFP_Flight_This_Month__c * Estimated_Daily_Revenue__c ),IF(RFP_Flight_Date__c <= Today AND (Days_Remaining_in_the_Month__c  >  Days_Remaining_in_RFP_Flight__c),THEN (Estimated_Daily_Revenue__c * Days_Remaining_in_RFP_Flight__c),IF(RFP_Flight_Date__c <= Today AND (Days_Remaining_in_the_Month__c  < Days_Remaining_in_RFP_Flight__c),THEN(Estimated_Daily_Revenue__c * Days_Remaining_in_the_Month__c ),Otherwise 0

That is the logic I am trying to solve.  I just dont know how to write it so the AND statment is inside the IF statement.

Let me know if you have any questions

Thanks in advance

Sean

 
  • February 09, 2015
  • Like
  • 0
I am trying to create a validation rule containing 2 picklists, 1 Multi-picklist and 1 text area field.

Fields
Picklists - "Owner_Role__c"
Multi-Picklist - "Benefits__c"
Text Area - "Comments__c"

The syntax I have is as follows

> AND(OR(ISPICKVAL( Owner_Role__c , "CSA"),ISPICKVAL( Owner_Role__c , "CSM")) &&  Comments__c = "" &&  ISBLANK( Benefits__c ))

I am not getting any syntax errors but it is not working. It is like it is ignoring the last argument. Even when I change fields to test it does nt recognize the last argument.

The rule should check to see if the owner role value is "CSM" or "CSA" and if it is, then the Benefits and comments fields should be required.

Any help appreciated.
Thank you.
When we use Web to Lead, we can provide a CampaignID to associate the Lead with specific Campaign.

I just recently found out that we can't use Lead.Campaign field since it is not available through the API.

Now how can one capture this fields on insert Trigger? IE, if a lead is added VIA web-to-lead and we want to get the campaign associate with it but we capture this on the insert.  We can't query the database for it because the lead and the campaign member is not added yet.



 
Hi,

This is a Single Sign On with Microsoft Azure AD issue.  

I'm setting it up on a sandbox and getting an error when tried to log in.  
Login Error
Your login attempt using single sign-on with an identity provider certificate has failed. Please contact your salesforce.com administrator for more information.

I'm looking at the SSO SAML Validator and see these errors below.  I think #4 can be ignore but #6 may cause an issue.  Do you know how to resolve this issue?

Thanks,
Results
 
Last recorded SAML login failure:  2015-03-24T21:10:51.428Z
Unexpected Exceptions
  Ok
1. Validating the Status
  Ok
2. Looking for an Authentication Statement
  Ok
3. Looking for a Conditions statement
  Ok
4. Checking that the timestamps in the assertion are valid
  Current time is after notOnOrAfter in Conditions
  Current time is: 2015-03-24T21:23:53.412Z
  Time limit in Conditions, adjusted for skew, is: 2015-03-24T21:18:51.884Z
  Timestamp of the response is outside of allowed time window
  Current time is: 2015-03-24T21:23:53.412Z
  Timestamp is: 2015-03-24T21:10:51.884Z
  Allowed skew in milliseconds is 480000
  Timestamp of the assertion is outside of allowed time window
  Current time is: 2015-03-24T21:23:53.412Z
  Timestamp is: 2015-03-24T21:10:51.869Z
  Allowed skew in milliseconds is 480000
5. Checking that the Attribute namespace matches, if provided
  Not Provided
6. Miscellaneous format confirmations
  InResponseTo must be empty for Idp-init Browser POST Profile
7. Confirming Issuer matches
  Ok
8. Confirming a Subject Confirmation was provided and contains valid timestamps
  Ok
9. Checking that the Audience matches
  Ok
10. Checking the Recipient
  Ok
  Organization Id that we expected: 00Dq00000009EyE
  Organization Id that we found based on your assertion: 00Dq00000009EyE
11. Validating the Signature
  Is the response signed? false
  Is the assertion signed? true
  Is the correct certificate supplied in the keyinfo? true
  Ok
12. Checking that the Site URL Attribute contains a valid site url, if provided
  Not Provided
13. Looking for portal and organization id, if provided
  Not Provided
14. Checking if session security level is valid, if provided
  Ok

Subject: [[[My User Email]]]
Unable to map the subject to a Salesforce.com user
AssertionId: _6f0bcc79-a407-46db-bf31-b7b5394a2ce3

 
I'm experiencing an issue with commandButton and reRender a section.

We have a list of contacts on the pages and a button to add a new blank contact lookup.  (Steps below)
1.  We add 1 blank contact (a input with the contact search) -- <apex:inputField value="{!contact}"/>
2.  Then I search for the contact for this 1st contact input.
3.  Then click an action (simply add a new contact to a List<Contact> on the page) and then reload that contact list section.
4.  The section is refreshed but the input in #2 is lost.

When I don't do reRender section (refresh the whole page), the input in Step #2 is NOT Lost.

I wonder if there anyway to prevent this.

Thanks.
 
We have a visualforce page that generate PDF and msWord which include a table with width=100%.  It has been working great and haven't been modified in the last couple of month.

We started to see this issue where the table tag generate a width that is beyond the PDF and msWord page width after 2015 Latest release.

The part that generate the code is below.  so I wonder if this is a bug for 2015 or what's changed in 2015 latest release that could of cause this.  Are there anyone else having the same issue?
<apex:outputPanel layout="block"  style="width:100%; border:solid 1px black;  text-align:left;float:left;" rendered="{!IssueTasks != null && IssueTasks.size > 0}">
        <p><b>{!SectionNames['ita']}</b></p>
        <table class="issueTaskDetail" width="100%">
            <tr>
                <th align="center" width="150px">Issue</th>
                <th align="center">Subject</th>
                <th align="center" width="100px">Date</th>
            </tr>
            <apex:repeat value="{!IssueTasks}" var="rec">
                <tr>
                    <td class="{!IF(rec.ShowDetailInProfile__c, 'hasDetail', '')}"><apex:outputText value="{!rec.What.Name}" /></td>
                    <td class="{!IF(rec.ShowDetailInProfile__c, 'hasDetail showBorder', '')}"><apex:outputText value="{!rec.Subject}" /></td>
                    <td class="{!IF(rec.ShowDetailInProfile__c, 'hasDetail', '')}" align="right"><apex:outputText value="{0,date,M/dd/yyyy}"><apex:param value="{!rec.ActualActivityDate__c}"/></apex:outputText></td>
                </tr>
                <apex:actionRegion rendered="{!rec.ShowDetailInProfile__c}">
                    <tr>
                        <td class="detail">&nbsp;</td>
                        <td class="detail" colspan="2"><apex:outputText value="{!rec.Description}"></apex:outputText>   </td>
                    </tr>
                </apex:actionRegion>
            </apex:repeat>
            <tr>
                <td colspan="3" class="footer"></td>
            </tr>
        </table>    
    </apex:outputPanel>

 
When we use Web to Lead, we can provide a CampaignID to associate the Lead with specific Campaign.

I just recently found out that we can't use Lead.Campaign field since it is not available through the API.

Now how can one capture this fields on insert Trigger? IE, if a lead is added VIA web-to-lead and we want to get the campaign associate with it but we capture this on the insert.  We can't query the database for it because the lead and the campaign member is not added yet.



 
Hi,

This is a Single Sign On with Microsoft Azure AD issue.  

I'm setting it up on a sandbox and getting an error when tried to log in.  
Login Error
Your login attempt using single sign-on with an identity provider certificate has failed. Please contact your salesforce.com administrator for more information.

I'm looking at the SSO SAML Validator and see these errors below.  I think #4 can be ignore but #6 may cause an issue.  Do you know how to resolve this issue?

Thanks,
Results
 
Last recorded SAML login failure:  2015-03-24T21:10:51.428Z
Unexpected Exceptions
  Ok
1. Validating the Status
  Ok
2. Looking for an Authentication Statement
  Ok
3. Looking for a Conditions statement
  Ok
4. Checking that the timestamps in the assertion are valid
  Current time is after notOnOrAfter in Conditions
  Current time is: 2015-03-24T21:23:53.412Z
  Time limit in Conditions, adjusted for skew, is: 2015-03-24T21:18:51.884Z
  Timestamp of the response is outside of allowed time window
  Current time is: 2015-03-24T21:23:53.412Z
  Timestamp is: 2015-03-24T21:10:51.884Z
  Allowed skew in milliseconds is 480000
  Timestamp of the assertion is outside of allowed time window
  Current time is: 2015-03-24T21:23:53.412Z
  Timestamp is: 2015-03-24T21:10:51.869Z
  Allowed skew in milliseconds is 480000
5. Checking that the Attribute namespace matches, if provided
  Not Provided
6. Miscellaneous format confirmations
  InResponseTo must be empty for Idp-init Browser POST Profile
7. Confirming Issuer matches
  Ok
8. Confirming a Subject Confirmation was provided and contains valid timestamps
  Ok
9. Checking that the Audience matches
  Ok
10. Checking the Recipient
  Ok
  Organization Id that we expected: 00Dq00000009EyE
  Organization Id that we found based on your assertion: 00Dq00000009EyE
11. Validating the Signature
  Is the response signed? false
  Is the assertion signed? true
  Is the correct certificate supplied in the keyinfo? true
  Ok
12. Checking that the Site URL Attribute contains a valid site url, if provided
  Not Provided
13. Looking for portal and organization id, if provided
  Not Provided
14. Checking if session security level is valid, if provided
  Ok

Subject: [[[My User Email]]]
Unable to map the subject to a Salesforce.com user
AssertionId: _6f0bcc79-a407-46db-bf31-b7b5394a2ce3

 
I'm experiencing an issue with commandButton and reRender a section.

We have a list of contacts on the pages and a button to add a new blank contact lookup.  (Steps below)
1.  We add 1 blank contact (a input with the contact search) -- <apex:inputField value="{!contact}"/>
2.  Then I search for the contact for this 1st contact input.
3.  Then click an action (simply add a new contact to a List<Contact> on the page) and then reload that contact list section.
4.  The section is refreshed but the input in #2 is lost.

When I don't do reRender section (refresh the whole page), the input in Step #2 is NOT Lost.

I wonder if there anyway to prevent this.

Thanks.
 
I have a requirement to create a validation rule to prevent transferring of records outside of a role.  I would like to allow users of a role to transfer objects owned by users in their role.  Any users outside of their role would not have permission to transfer records.  

Currently, our security is set to private and we enable view access to all accounts,leads,opportunity objects.  We have in place sharing rules per object per role, that give access to users within their respective role to edit those objects.  People outside that immediate role, do not have access to edit those objects.

The solution provides this : 

Mary in Role A
Joe in Role A
Bob in Role B

Mary can transfer an account that Joe owns into her name, but cannot transfer an account that Bob owns.  Bob cannot transfer Mary or Joe's account into his name.  

Is there a formula to use for a validation rule to only allow transferring objects based on roles as described in the example above?

Thanks!
Hi,
I am writing a before insert trigger that updates a field on the account whenever an attachment is added but only if the person adding the attachment is not the owner.  I try to select the owner of the associated account based on the attachment.parentid but it doesn't return any rows.  I tried to hardcode the parentid and it still doesn't return any rows.  The row is definitely there because I can query it and it does return a row.  Why does it not return the row.  Below are the trigger definition and the test class.  Thank you.
trigger AttachmentTrigger on Attachment (before insert) {
	List<Account> accountList = new List<Account>();

   Set<Id> accIds = new Set<Id>(); 
     for(Attachment att : trigger.New){
         //Check if added attachment is related to Account or not
         if(att.ParentId.getSobjectType() == Account.SobjectType){
      	Account a	= [select id,OwnerId from account where id = '001M000000Y2Rbx']; // :att.ParentId];
      	if (a.OwnerId != att.OwnerId)
              accIds.add(att.ParentId);}

    }
    accountList = [select id, has_Attachment__c from Account where id in :accIds];
    if(accountList!=null && accountList.size()>0){
        for(Account acc : accountList){
            acc.has_Attachment__c = true; 
        }
        update accountList;
    }         
	

}
private class TestAttachmentTrigger {

    static testMethod void myUnitTest() {
//    	Account[] a = [Select Id,name from account where Id = '001M000000Y2Rbx'];
    	User u2 = [select id from User where alias='administrator']; 
    	system.runAs(u2){
    	Blob body;
    	body = Blob.valueOf('test');
    	Attachment Attach = new Attachment();
    	Attach.ParentId = '001MxyzbwY2Rbx';  //id of an existing account
    	Attach.OwnerId = u2.Id;
    	Attach.Name = 'newattach';
    	Attach.Body = body;
    	insert Attach;
    	}

    }
}



 
  • February 09, 2015
  • Like
  • 0

if my expense type is (picklist) "office rent"  , then 10% on  the expense field be displayed in another custom field TDA.

using formula as a data type can any one tell me the logic for this?

Thanks in advance

We have a visualforce page that generate PDF and msWord which include a table with width=100%.  It has been working great and haven't been modified in the last couple of month.

We started to see this issue where the table tag generate a width that is beyond the PDF and msWord page width after 2015 Latest release.

The part that generate the code is below.  so I wonder if this is a bug for 2015 or what's changed in 2015 latest release that could of cause this.  Are there anyone else having the same issue?
<apex:outputPanel layout="block"  style="width:100%; border:solid 1px black;  text-align:left;float:left;" rendered="{!IssueTasks != null && IssueTasks.size > 0}">
        <p><b>{!SectionNames['ita']}</b></p>
        <table class="issueTaskDetail" width="100%">
            <tr>
                <th align="center" width="150px">Issue</th>
                <th align="center">Subject</th>
                <th align="center" width="100px">Date</th>
            </tr>
            <apex:repeat value="{!IssueTasks}" var="rec">
                <tr>
                    <td class="{!IF(rec.ShowDetailInProfile__c, 'hasDetail', '')}"><apex:outputText value="{!rec.What.Name}" /></td>
                    <td class="{!IF(rec.ShowDetailInProfile__c, 'hasDetail showBorder', '')}"><apex:outputText value="{!rec.Subject}" /></td>
                    <td class="{!IF(rec.ShowDetailInProfile__c, 'hasDetail', '')}" align="right"><apex:outputText value="{0,date,M/dd/yyyy}"><apex:param value="{!rec.ActualActivityDate__c}"/></apex:outputText></td>
                </tr>
                <apex:actionRegion rendered="{!rec.ShowDetailInProfile__c}">
                    <tr>
                        <td class="detail">&nbsp;</td>
                        <td class="detail" colspan="2"><apex:outputText value="{!rec.Description}"></apex:outputText>   </td>
                    </tr>
                </apex:actionRegion>
            </apex:repeat>
            <tr>
                <td colspan="3" class="footer"></td>
            </tr>
        </table>    
    </apex:outputPanel>

 
I am trying write a formual that uses if and AND statments.  the logic I am trying to write is

IF(RFP_Flight_Date__c > today (), ( Days_Remaining_in_RFP_Flight_This_Month__c * Estimated_Daily_Revenue__c ),IF(RFP_Flight_Date__c <= Today AND (Days_Remaining_in_the_Month__c  >  Days_Remaining_in_RFP_Flight__c),THEN (Estimated_Daily_Revenue__c * Days_Remaining_in_RFP_Flight__c),IF(RFP_Flight_Date__c <= Today AND (Days_Remaining_in_the_Month__c  < Days_Remaining_in_RFP_Flight__c),THEN(Estimated_Daily_Revenue__c * Days_Remaining_in_the_Month__c ),Otherwise 0

That is the logic I am trying to solve.  I just dont know how to write it so the AND statment is inside the IF statement.

Let me know if you have any questions

Thanks in advance

Sean

 
  • February 09, 2015
  • Like
  • 0
I am trying to create a validation rule containing 2 picklists, 1 Multi-picklist and 1 text area field.

Fields
Picklists - "Owner_Role__c"
Multi-Picklist - "Benefits__c"
Text Area - "Comments__c"

The syntax I have is as follows

> AND(OR(ISPICKVAL( Owner_Role__c , "CSA"),ISPICKVAL( Owner_Role__c , "CSM")) &&  Comments__c = "" &&  ISBLANK( Benefits__c ))

I am not getting any syntax errors but it is not working. It is like it is ignoring the last argument. Even when I change fields to test it does nt recognize the last argument.

The rule should check to see if the owner role value is "CSM" or "CSA" and if it is, then the Benefits and comments fields should be required.

Any help appreciated.
Thank you.