• Akhil Anil
  • PRO
  • 2745 Points
  • Member since 2015

  • Chatter
    Feed
  • 86
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 1
    Questions
  • 334
    Replies
My requirement is to only allow users with the profile of "Freelance Writer" to change the value of the Status__c picklist if the current value of Status__c is "Assigned", "Sent For Revisions by Editor", or "Sent for Revision by Client". Here is what I have so far:
 
AND
(
 $Profile.Name = "Freelance Writer",
ISCHANGED(Status__c),
NOT(ISPICKVAL(Status__c,"Assigned")),
NOT(ISPICKVAL(Status__c,"Sent for Revisions by Editor")),
NOT(ISPICKVAL(Status__c,"Sent for Revisions by Client")))
But its not quite right - seems it restricts the user from making change to Status__c even if Status__c is set to one of the acceptable values.  Do I somehow need to use PRIORVALUE for this?
 
Hi, 

I need some help with a formula. 

I need to create a "Client Due Date" field. This formula should be based off (the Submission date field) Submission_Date__c PLUS a number that is selected from the picklist value from the Processing Days (Processing_Days__c) field which includes the values: 8.9,10,11,12,13,14,15 

Could someone please help me out on this one?

Thanks
Tori
Can anyone see why my lead conversion is failing?

User-added image
This exception usually happens when a batch is being run or alerts are coming into our Salesforce instance too quickly. When inserting a case, we try to lock down the contact and account associated with the case before inserting the case to prevent the 'UNABLE_TO_LOCK_ROW' exception from happening.

Here is the exact exception:
'System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again.'
Class.Utility.DoCaseInsertion: line 98, column 1

I've done a lot of research on the 'UNABLE_TO_LOCK_ROW' exception and 'Record Currently Unavailable' exception and I can't seem to find a great solution to this issue.

What I've tried to accomplish is a loop to attempt the insert 10 times, but I'm still getting the 'Record Currently Unavailable' exception. Does anyone else have a suggestion for this?

Below is the code:

    Public static void DoCaseInsertion(case myCase) { try { insert myCase; } catch (System.DmlException ex) { boolean repeat = true; integer cnt = 0; while (repeat && cnt < 10) { try { repeat = false; List<Contact> contactList = [select id from Contact where id =: myCase.ContactId for update]; // Added for related contact to overcome the 'UNABLE_TO_LOCK_ROW issues' List<Account> accountList = [select id from Account where id =: myCase.AccountId for update]; // Added for related account to overcome the 'UNABLE_TO_LOCK_ROW issues' insert myCase; } catch (System.DmlException e) { repeat = true; cnt++; } } } }
  • February 03, 2017
  • Like
  • 0
Hi all,

I would need help with this formula. I get a message: Syntax error. Any idea, please?

IF ( PotentialCOMAPABudget__c  < 200.000,"Bajo",

IF ( PotentialCOMAPABudget__c > 200.000 < 1.000.000, "Medio", 

IF ( PotentialCOMAPABudget__c > 1.000.000, "Alto",

IF (  PotentialCOMAPABudget__c > 5.000.000, "Key Account", null

)
)
)
)
  • February 03, 2017
  • Like
  • 0
I want to create a formula that will execute when the "Lead Owner Queue" get changed to a "Lead Owner User". 
Everything I try gives me an error:

 Owner:Queue.Id  ISCHANGED(field) 

Can Someone help me create the right formula Please

Adeline
I am not 100% sure what is wrong with this Test Script:

@isTest
    public class EndoraDocumentAttachment { 

        //Method
        static testMethod void InsertAttachment() {

        Opportunity b = new opportunity();
        b.RecordType.developername = 'Capital';   
        b.name = 'TEST';
        b.Quote_Contact__c = '0033B000007Rz8X';   
        b.StageName = 'Attention';
        b.CloseDate = (System.Today().addDays(1));
        b.Account_Dept__c = 'GI/Endoscopy';
        insert b;

        Attachment attach = new Attachment();

        attach.Name='Unit Test Attachment';
        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        attach.body=bodyBlob;
        attach.parentId=b.id;
        insert attach;

        List<Attachment> attachments=[select id, name from Attachment where parent.id=:b.id];
        System.assertEquals(1, attachments.size());

         attach = [SELECT Id, name from Attachment where parent.id=:b.id];

            delete attach;  

            b.Attachment__c = False;
            update b;      


    }
    }


Errors: System.NullPointerException: Attempt to de-reference a null object
Stack Trace: Class.EndoraDocumentAttachment.InsertAttachment: line 8, column 1
Hello,

I have object "account" which have 5 record types, there are around 10 profiles in my org.
For object "account" there are few picklist.

For one of the profile, presently 5 pricklist are available out of 8.
For certain users of this profile i want only 3 prickist to be avaiable.

How can i i acieve my usecase ?
thanks for suggestion!
 
  • January 30, 2017
  • Like
  • 0

Hi Guys, 

Im fairly new and looking to setup some things.

I want to configure an Email Alert when a Picklist field has been sitting on a value for more than a number of specified days. 

For example, i have a picklist field called "stage". i want the record owner to be notified thru email when the stage is at the "quoting" value for more than 2 days. 

Reading here i know i have to set up a workflow, im trying to make a formula but i dont find a way to come up with the right syntax. 
Here is what i come up with so far:

Stage(TEXT(Quoting)) && TODAY - DATEVALUE(LastModifiedDate)>= 2


Please HELP

How to track the implementation of the trigger.new and trigger.old I am not getting a clear picture on this   . Anyone explain this example making the differences clear.  

trigger emailCheck on Employee__c (before update) 
{
    Map<Id,Employee__c> o = new Map<Id,Employee__c>();
    o = trigger.oldMap;
    for(Employee__c n : trigger.new)
    {
        Employee__c old = new Employee__c();
        old = o.get(n.Id);
        if(n.Email__c != old.Email__c)
        {
            n.Email__c.addError('Email cannot be changed');
        }
    }
}

Thanks and Regard
Rohit kumar singh
Hello, I need to create a workflow rule that triggers when the opportunity stage changes and sends an email, as long as it doesn't change to some values, this is what I got that isn't working:
 
IF(
ISCHANGED(StageName) 
AND (
 NOT(ISPICKVAL(StageName, "Value 1")), 
 NOT(ISPICKVAL(StageName, "Value 2")),
 NOT(ISPICKVAL(StageName, "Value 3")),
 NOT(ISPICKVAL(StageName, "Value 4"))
))

 
  • January 26, 2017
  • Like
  • 0
I need to create a validation rule for a object , The validation rule should check if the filled text field value contain the value that is valid for a picklist already present . ie : there are two fields ,one text field t1 and picklist p1 with values (v1,v2,v3) at object level . I want to verify if user entered data on text field t1 as one among the value present in picklist p1. Let me know if this can be done through validation rule itself ? I know it is possible through apex code , but my current requirement is to do it through validation rule. Please do share your knowledge

Thanks and Regards,
Shiva RV
Hi, 

I need to create a trigger or validation rule that requires a user to attach a document/insertion order to an opportunity when it is changed to 100% or closed won.

Please advise. 

  
I am trying to get a Status field to update when two other fields equal. I am not getting any errors with my code, however it does not seem to be working properly. Please take a look and let me know your thoughts!
Thank you,
Trigger

trigger Read on Web_Links__c (before update){
    StatusRead.Read(Trigger.new);
}


Class

public class StatusRead {
    public static void Read(List<Web_Links__c> WI){
        Web_Links__c WL = [SELECT status__c FROM Web_Links__c];
            if(WL.Owner_ID__c == WL.Last_user_to_view_record__c){
                WL.status__c = 'Read';
                update WL;
           }
    }
}

 
Hi there, 
is it possoble to update the Account Type after an Email Message is sent ?  It tried the process builder, but it did not work. The Email is related to the Account. Thanks for your help guys ! ;)  
I have a User A B C and D...i have a field Email in all User...my requirment is 'The field Email shoud be mandatory in Both A and B users but not for Users C and D,,? how to achieve this ?
Hello All , 

I'hv a basic question on Updating fileds using APEX Code - rather I want to clear my concepts . The requirement is very simple. For Account Object , Update all Countries to United States of America where country is like US or USA . Now, I'm able to do it by writing below code

Public Class Acc_Country_Name_Change
{
     
   Public Pagereference Name_update()
   {
     
      List<Account> Act = [SELECT name,BillingCountry FROM Account where BillingCountry in ( 'US','USA')];
 
      for(Account a : act)
          {
      a.BillingCountry ='united states of america';
          } 
  update act;
     
      return null;
 
  }
 
 }

Now , I'hv two questions on this . Please help me to clear my concept. 

1> in the For loop , its like FOR ( sObject : List ) - so why both are not List ? is it because in FOR Loop , only one row get processed at a time ? Or something else?

2> Inside the FOR loop , we are writing a.BillingCountry ='united states of america'  , but in update its like Update act . Why so? 

Can someone please help me to clarify my doubts? I know they are very basic , But I'm kind of confused.

Thanks,
Tanoy
Hello,

First of all, I am just the administrator, not a developer and not a coder. However today I am wearing all the hats.  I am hoping someone would be kind enough to help me with the following. I am not sure of even where to start, except that I should do this by a trigger. However I know nothing of how to actually accomplish this. I am hoping that someone could provide the code necessary as I am not savvy enough to write any of it myself. Being a non-profit, we do not have the budget to enlist a professional for this and the task has fallen to me to handle.

Short story - Due to a third party integration, we found that we needed an email address on the account page. However, with the one-to-one model, we are essentially unable to access the true Account record for an individual.  What I would like to accomplish is this:  a trigger that will copy the email address from our Contact object into our email field on the Account object. This would happen when the field is changed in any way.

I hope that I've provided enough information, but if not I will gladly elaborate where needed. Thanks in advance everyone.
Hello! 

We have the trigger below that if an attachment is deleted from Chatter Feed, certain profiles will recieve the error message. I need assistance in updating the trigger to only fire on a certain object (Documents_Manager__c). Currently the trigger is firing on all objects. The trigger is also currently blocking the System Administrator profile for testing testing purposes but we would like to add serveral profiles to the block list as well. Thank you in advance!
trigger ChatterDeleteBlocker on FeedItem (After Delete) {
 User u = [SELECT id,ProfileId,Profile.Name  FROM User WHERE id = :UserInfo.getUserId()];
        for(FeedItem fi : trigger.old)
        if(fi.type == 'ContentPost' && u.Profile.Name == 'System Administrator')
            fi.addError('You do not have the permissions to delete files from chatter feed');
}
  • January 20, 2017
  • Like
  • 0
I need to hide/disable the back button that appears on the top left corner when I navigate from one component to another. I do not want to keep track of the history/trail path of the component's navigation.

Any trick on how to achieve this ?
I've been asked to update an Opportunity lookup field (looks up Custom Object "Threshold") based on 3 Opportunity picklist values (they are also dependant picklists) with a Threshold record id that matches those 3 picklist values. 

Opportunity picklist fields:
a1. Market
b1. Vertical
c1. Segment

Threshold fields:
a2. Market (Custom Field)
b2. Record Type
c2. Segment (Standard Name Field)

Conceptual plan:
When a1,b1,c1  are selected, update lookup to Threshold with Threshold record that matches a2,b2,c2 to a1,b1,c1

I am thinking on using process builder to set the criteria which covers {a1,b1,c1 are selected} I am stuck finding a way to create a formula that pulls the record based on matching the Opportunity picklist values.

Thanks in advance!
  • April 25, 2017
  • Like
  • 0
We have a validation rule that uses ischanged on a long text field and on a rich text field. when either one of them is changed, the validation rule should fire. It appears that the ischanged() doesnt work with rich text field in validation rule and the rul fires even when the field isnt changed?  Has anyone experienced this issue?
For record type '012a0000000AWNv' , If the picklist value of 'Report: New/Modify (Complete Section I)' is chosen from the field 'SF_Request_Type__c', then I want the user to be forced to make either the 'Modify_Existing_Report__c' checkbox or the 'Create_New_Report__c' checkbox to be true.

With the validation rule that I have written below, it's forcing the user to choose either checkbox REGARDLESS of the value in the picklist field. If you can help, that would be really great...

AND( 
Modify_Existing_Report__c = FALSE, 
Create_New_Report__c = FALSE, 

OR( 
ISPICKVAL (SF_Request_Type__c, "Report: New/Modify (Complete Section I)"), 
RecordTypeId = '012a0000000AWNv'))
I have created a process on process builder that checks for certain critiera. IF criteria is met then process assigns task to one of the account managers. Because of the limitations with process builder, I haven't be able to run this process periodacly as I wish. The trigger in process builder is limited to Create or Update records..

Can someone walk me through how build such a trigger in Apex? 

Thanks,
Fares Alsyoufi.
Hi All,

I have a requirment to bulid a formula which would tweek the values selected from some picklist values. The issue is the length of my formula is '44000' and i hold sfdc allow only 3900 char in formula. If i  split the formula also i may have to create nearly 10 formula field and then concatinate them. Is there any workaround for this please suggest.

Thanks!
We have a validation rule on Opportunity Stage that does not allow most users to change to stage to "Closed Won".  There is a dependent picklist field "Sales Status" that has values which are aligned to "Closed Won" values/answers that we need those blocked users to be able to select even though they are not allowed to change Opportunity stage to "Closed Won"  ie; allow for the pick list values without changing Stage.   Would it be easier to have a pre-"closed won" stage without validation where the dependant fields that resides on Closed Won can be set prior to the fianl setting of closed won by those users that can modify stage?
I have two picklist fields which are dependent.I have to populate a text based on the two picklist fields
HI All,

I have 2 custom picklist fields, Eg : abc__c(New, Open, Inprogress) and xyz__c(High, Medium, Low, Average)
If the value of picklist abc__c is 'New' , xyz__c should not be 'Required' and for all rest of values on abc__c , xyz__c should be Required 

Need an validation rule for this.. 

Thanks!!
Hello All ,  I know how to add a lightning component created via developer console to a VF page.

My question is , is there a way to a component created via Lightning App Builder to a VF Page ?

Thank you all
My requirement is to only allow users with the profile of "Freelance Writer" to change the value of the Status__c picklist if the current value of Status__c is "Assigned", "Sent For Revisions by Editor", or "Sent for Revision by Client". Here is what I have so far:
 
AND
(
 $Profile.Name = "Freelance Writer",
ISCHANGED(Status__c),
NOT(ISPICKVAL(Status__c,"Assigned")),
NOT(ISPICKVAL(Status__c,"Sent for Revisions by Editor")),
NOT(ISPICKVAL(Status__c,"Sent for Revisions by Client")))
But its not quite right - seems it restricts the user from making change to Status__c even if Status__c is set to one of the acceptable values.  Do I somehow need to use PRIORVALUE for this?
 

Hi 
We are currently having issues in our environment where we've gone and created 2 Process Builders pulling from Task and then updating on the Contact.  

Error element myRule_1_A1 (FlowRecordUpdate).
The flow tried to update these records: 0032A00002VB8EmQAL. This error occurred: ALL_OR_NONE_OPERATION_ROLLED_BACK: Record rolled back because not all records were valid and the request was using AllOrNone header. For details, see API Exceptions.

More so, we are having issues with the flows when lead conversion happens.  

Error: System.DmlException: Update failed. First exception on row 0 with id 00T23000005q7a7EAA; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 301230000000VKM. Flow error messages: <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: [] Class.leadconvert.BulkLeadConvert.updateLeadTasks: line 1279, column 1 Class.leadconvert.BulkLeadConvert.convertLead: line 127, column 1

We've concluded that we get these errors when the Lead has more than 10 or 20 tasks related.  Those tasks in particular are the ones that trigger our Process Builder.  

We tried to diagnose the issue in Sandbox as well.  Based on posts I've read it's possible that we are hitting limitations

Does anyone have any suggestions aside from creating an Apex Trigger to do this?  

Hi All,

Need some advice re Locker Service.  As locker service will be auto enabled in Summer ’17 release, has anyone activated the LockerService critical update and test in sandbox to verify the correct behaviour of the components? If so, would be great to know what kind of issues faces and any recommended approach, best practice to resolve those? . 

Thanks in advance. 
Regards
-Riti
Hi, 

I need some help with a formula. 

I need to create a "Client Due Date" field. This formula should be based off (the Submission date field) Submission_Date__c PLUS a number that is selected from the picklist value from the Processing Days (Processing_Days__c) field which includes the values: 8.9,10,11,12,13,14,15 

Could someone please help me out on this one?

Thanks
Tori
Can anyone see why my lead conversion is failing?

User-added image
Hi Friend,

Now I m using Professional edition . I need to avoide duplcate company websites in Account object. For this one how to write validation rule on this field ?
I want to create a Json string that has a document that shows base64
ex.
{ "first name" : "Rob, "mypdfdoc" : "AAASDECgtNhr==" }

when I pass the file to JavaScript it encodes it to base64 .
when I pass it back to a string type in my controller it shows [file type object]
not AAASDEC...
Any ideas why it is not showing it as a base64 string, instead displays [file type object] in the debug log?
Basically I want to take the base64 string and use put to assign to a map
thank you
 
Hi,

I am trying to validate the phone number on the contact according to multiple formats. I want users to be able to enter phone numbers that match one of three formats, one starting with "+" , another starting with "00" and finaly one starting with "(".

I can create all of the these as single validation rules, but when I try to combine two or more, I am struggling wiht the logic even if the syntax of the formula is correct.

Any suggestions?
Hi, There are 2 objects, Contacts and a custom object. The custom object has a lookup to Contact object.
My requirement is that I need to quey all those records from the custom object which do not have a lookup to Contact.

Please help.
​Thanks.
I tried creating the following formula, but I got an error message that said there were too many characters in my formula. I'm trying to use the CONTAINS function, but I'm losing my formula ... any help is appreciated. 

IF(ISPICKVAL(Service_Type_del__c, "One-time"),
ABS((Cost__c * Probability) / 1),

IF(ISPICKVAL(Service_Type_del__c, "Yearly"),
ABS((Cost__c * Probability) / 1),

IF(ISPICKVAL(Service_Type_del__c, "Twice Yearly"),
ABS((Cost__c * Probability) / 2),

IF(ISPICKVAL(Service_Type_del__c, "Quarterly"),
ABS((Cost__c * Probability) / 4),

IF(ISPICKVAL(Service_Type_del__c, "Monthly"),
ABS((Cost__c * Probability) / 12),

IF(ISPICKVAL(Service_Type_del__c, "Twice Monthly"),
ABS((Cost__c * Probability) / 12),

IF(ISPICKVAL(Service_Type_del__c, "Weekly"),
ABS((Cost__c * Probability) / 12),

IF(ISPICKVAL(Service_Type_del__c, "Twice Weekly"),
ABS((Cost__c * Probability) / 12),

IF(ISPICKVAL(Service_Type_del__c, "Daily"),
ABS((Cost__c * Probability) / 12),

0
)))))))))
Currently I m using next and previous arrow buttons on click of which i call my javascript function. I want to call this function on left and right swipe event. Can somebody suggest a way to capture the left and right swipe on my component?
Hi All,
     I had gone through some problems working withDescription field so now I got a solution to work with "Long Text Area DataType", if you want to count() the records or other filtering things with Description.
   I made a custom field "Notes__c"(Text Area) in contact object and using Trigger i copied the contents of Description field to Notes__c.
here is the code:
trigger CopydescToNotes on Contact (before insert,before update) {
for(Contact c : Trigger.new)
if(c.Description!=null)
c.Notes__c=c.Description;
}


Thanks 
Shephali