• Phani PYDIMARRY 11
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 6
    Replies
Hello,

I would want to get last month date from today. But I am wondring how can I get the Year if the current date is 01/21/2020. Below is the formula I am using
{!TEXT( MONTH( TODAY()-1))}%2f{!TEXT( DAY( TODAY()-30))}%2f{!TEXT( YEAR( TODAY()))}

I hope the Salesforce Legends can solve my case.

Thanks
Hello, 

I am trying to pass a link where in I have a requirment to pass today's date and today's date Minus 30 days. The link is something like this . V&ID is a custom field which I have acheived but how to format the date like below 
 
/usocLocator.aspx?type=V&id=632&from=12%2f01%2f2019&to=05%2f18%2f2020

 
Hello,

I am trying to compare the New value in a field which is a string and if it contains 'NO CHANGE' in it, then I would want to replace it by the Old Value. Below is my code. It seems to be not considering Contains expression as it it taking NO CHANGE but not a scentense where NO CHANGE is present. like THIS. HAS NO CHANGE. Below is my code in Before Update

Old Record - This is New 
New Record - this is new - NO CHANGE
Trigger fires and then changes to Old Record - This is New 

 
for(sObject newRecobj: Trigger.new){

myObject__C newRec = (myObject__C) newRecObj;

SObject oldRecObj = Trigger.oldMap.get(newRec.Id);

myObject__C oldRec = (myObject__C) oldRecObj;

if('NO CHANGE'.contains(newRec._NOTE__c) 
    && !string.isBlank(oldRec.NOTE__c) 
&& !'NO CHANGE'.contains(oldRec.NOTE__c)){

                newRec.NOTE__c = oldRec.NOTE__c;
            }

}

What i am I doing wrong here? 
Hello, 
I have a unique name which is a number in string format and tracking_code on an object and I there are other duplicate records too with the same combination. I would want to find the records with the same combination to use them somewhere else. Please see my code and let me know if I am doing it right.
List<Account> inaccts = [select ID, name, tracking_code__c from Account where flag__c = false];
map<string, ID> inactiveRecs = new map<string, ID>();
for(Account acc:inaccts ){
inactiveRecs.put(acc.name, acc.code__C);
}

// I am creating this list to extract exact combination of name and tracking_code for records whose flag is true
list<Account> actAccs = [select ID, name, tracking_code__c from Account where flag__c = true AND name in: inactiveRecs.keyset() AND tracking_code__c in inactiveRecs.values() ];

 
I would want to write a batch class to consider some Account records which have a flag unchecked and then compare them with a duplicate Account records created with the same name which are checked to update other values. I am new to APEX please let me know how can I frame the code.
Global class myBatch implements Database.Batchable<sobject>{
    Global myBatch(){
        }
global Database.Querylocator start(Database.Bachablecontext context){

   return Database.getQuerylocator([Select ID, Name from Account where BATCH_PROCESS__c = FALSE]);
}

global void execute(Database.BatchableContext BC, List<Account> scope){
    //I would want to get those Account names which have a BATCH_PROCESS__c AS TRUE to compare 

list<Account> acc = ([Select Name from Account where BATCH_PROCESS__c = TRUE]);
    set<string> st = new set<string>();
    for(Account act: acc){
    st.add(act.name);
}
 try{
     
     for(Account active:scope){
         
         //I am struck here on how to compare the values from the string
     }
  }catch(Exception e){}
}
}

 
Hello,
I would want to Check two fields, one has some data and one is null, then I would want to fire the Workflow. 
AND(NOT(ISBLANK(my_not_empty_field__c)), ISBLANK(My_Empty_field__c))
The purpose for doing this is a field update I am trying to do on My_Empty_field__c . And if I would want to change the value of My_Empty_field__c to my_not_empty_field__c and edit it if i want to , The above Workflow rule should not fire each time I edit this. 

Please let me know how can I do it
 
Hello,

I am trying to compare two strings which have a Semi coloumn. I have used split but I am unable to compare the strings. In the below example, the debug gives an error for BALL but other strings pass. Can anyone help me what I am I missing here?
 
STRING TEST1 = 'MY ; BALL ; CAR; PEN';
LIST<STRING> TEST2 = TEST1.SPLIT(';');
SYSTEM.debug(TEST2);

STRING TEST3 = 'MY ; BALL; CAR';
for(string test4:TEST3.split(';')){
    system.debug(test4);
    if(TEST2.contains(test4)){
        system.debug('working');
        system.debug(test2);
    }
    else{
        system.debug('not working');
    }
}

 
Hello,

I have two two picklists with same values per say
P1  P2
A     A
B     B
C     C

If I select A and B in P1 and select B and C in P2, I need to throw an error. Basically I need a validation rule to allow user to only select those values they selected in P1. I am a bit new to salesforce. Please help.

Regards,
Vineeth
I have a requirement in our community where a Question is generated as a Feeditem whenever our customers ask. There would be answers from other users which are Feeditems. Now when a Feeditem(Question) is deleted, I would want all the associated Feedcomments to be deleted.
Feedcomment have a FeedItemID associated with them. I am new to development, it would be great if someone could help me atleast a skeleton of the handler and trigger.
Hello,

I have a scenario where I need to capture Name, Email, phone and Type of the Account and also Credit Card , Expiry, CVV. from a child object.

When user enters details, a account is created and the the creditcard associated with it is also created.


How should I approach this scenario?
Hello,

I would want to get last month date from today. But I am wondring how can I get the Year if the current date is 01/21/2020. Below is the formula I am using
{!TEXT( MONTH( TODAY()-1))}%2f{!TEXT( DAY( TODAY()-30))}%2f{!TEXT( YEAR( TODAY()))}

I hope the Salesforce Legends can solve my case.

Thanks
Hello,

I am trying to compare the New value in a field which is a string and if it contains 'NO CHANGE' in it, then I would want to replace it by the Old Value. Below is my code. It seems to be not considering Contains expression as it it taking NO CHANGE but not a scentense where NO CHANGE is present. like THIS. HAS NO CHANGE. Below is my code in Before Update

Old Record - This is New 
New Record - this is new - NO CHANGE
Trigger fires and then changes to Old Record - This is New 

 
for(sObject newRecobj: Trigger.new){

myObject__C newRec = (myObject__C) newRecObj;

SObject oldRecObj = Trigger.oldMap.get(newRec.Id);

myObject__C oldRec = (myObject__C) oldRecObj;

if('NO CHANGE'.contains(newRec._NOTE__c) 
    && !string.isBlank(oldRec.NOTE__c) 
&& !'NO CHANGE'.contains(oldRec.NOTE__c)){

                newRec.NOTE__c = oldRec.NOTE__c;
            }

}

What i am I doing wrong here? 
I would want to write a batch class to consider some Account records which have a flag unchecked and then compare them with a duplicate Account records created with the same name which are checked to update other values. I am new to APEX please let me know how can I frame the code.
Global class myBatch implements Database.Batchable<sobject>{
    Global myBatch(){
        }
global Database.Querylocator start(Database.Bachablecontext context){

   return Database.getQuerylocator([Select ID, Name from Account where BATCH_PROCESS__c = FALSE]);
}

global void execute(Database.BatchableContext BC, List<Account> scope){
    //I would want to get those Account names which have a BATCH_PROCESS__c AS TRUE to compare 

list<Account> acc = ([Select Name from Account where BATCH_PROCESS__c = TRUE]);
    set<string> st = new set<string>();
    for(Account act: acc){
    st.add(act.name);
}
 try{
     
     for(Account active:scope){
         
         //I am struck here on how to compare the values from the string
     }
  }catch(Exception e){}
}
}

 
Hello,

I am trying to compare two strings which have a Semi coloumn. I have used split but I am unable to compare the strings. In the below example, the debug gives an error for BALL but other strings pass. Can anyone help me what I am I missing here?
 
STRING TEST1 = 'MY ; BALL ; CAR; PEN';
LIST<STRING> TEST2 = TEST1.SPLIT(';');
SYSTEM.debug(TEST2);

STRING TEST3 = 'MY ; BALL; CAR';
for(string test4:TEST3.split(';')){
    system.debug(test4);
    if(TEST2.contains(test4)){
        system.debug('working');
        system.debug(test2);
    }
    else{
        system.debug('not working');
    }
}