• Lil_Ranger1111
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 7
    Replies
if('{!project__c.vip__c}' == 'True'){
  location.replace('{!Project__c.Id}/e?clone=1&retURL=%2F{!Project__c.Id}');
}
else{
 alert('Sorry. You cannot clone a vip project.');
}
I'm trying to create a custom clone button to allow a project to be cloned if the checkbox vip is not checked and if it's check to throw the error.  It's currently showing the error even if the check box is not checked.  I'm not sure what I'm missing.
Just wondering if there is a way to capture in the history whom approved or rejected an approval process through email?  I know that all the information is captured in the approval history.  I'd just like to know how it was accepted/rejected.
Hi,

I have a formula field to pull the created date with the time,  but it is showing the seconds and the z.  How do I get rid of the seconds and z?  I've tried a couple of different ways and can get just the date or just the time, but not both.

TEXT(CreatedDate)


I'm trying to create a button on a child record that will give the user the option to go back to the parent record.  I created the following button and it's redirecting to the parent record but it's in edit mode.  I don't want it in edit mode I just want it to go to the parent.

/{!Information__c.UserContractId__c}/e?retURL=%2F{!Information__c.UserContractlId__c}
The parent record is a lookup to UserContract__c
The child record is AdditionalInfo__c

Any help is greatly appreciated.
I created a trigger to prevent the deletion of a parent record if a child record exists. I'm having problems with the test class. It says required field missing "Dept_Code__c". I have it in the test class, so I'm not sure what I'm missing.
Parent Object - Order_Request__c (Quantity, Cost Center (lookup), Order Type (lookup) are required fields.

Child Object - Order_Assignment__c (Order Request, Order Center (lookup) are required fields)

Any help is greatly appreciated.

trigger PreventOrderDeletion on Order_Request__c (before delete) {


    for(Order_Request__c lq : [Select Id, Name, (Select Id from Order_Assignments__r) from Order_Request__c where Id IN :trigger.oldMap.KeySet()]){

            if(lq.Order_Assignments__r != null && lq.Order_Assignments__r.size() > 0){

              lq.addError('The order request cannot be deleted because there is an associated order assignment record');

            }
     } 



@IsTest(SeeAllData=true)
public class PreventOrderDeletionTest{

static testMethod void PreventDeleteTest()
{
    //Create Parent Object
    Order_Request__c lic = new Order_Request__c(Name='Salesforce Testing');
    lic.Quantity__c = Decimal.valueOf('1.0');
    lic.Order_Type__c = 'a6xxxxxxxxxxxx';
    lic.Dep_Code__c = 'a6Oxxxxxxxxxxx';
    insert lic;

    //Start Test & create child object
    test.startTest();

    Order_Assignment__c asgn = new Order_Assignment__c();


    //Relate Child to the Parent from the inserted record above
    asgn.Order_Request__c = lic.Id;
    asgn.Dep_Code__c = lic.Default_Code__c;

    //Insert Child Record
    insert asgn;

    try {
    delete lic;
        } catch (Exception e) {
           system.assertEquals('You cannot delete this record!', e.getMessage());
          }
   //Stop Test
   test.stopTest();
}  
}


if('{!project__c.vip__c}' == 'True'){
  location.replace('{!Project__c.Id}/e?clone=1&retURL=%2F{!Project__c.Id}');
}
else{
 alert('Sorry. You cannot clone a vip project.');
}
I'm trying to create a custom clone button to allow a project to be cloned if the checkbox vip is not checked and if it's check to throw the error.  It's currently showing the error even if the check box is not checked.  I'm not sure what I'm missing.
Hi,

I have a formula field to pull the created date with the time,  but it is showing the seconds and the z.  How do I get rid of the seconds and z?  I've tried a couple of different ways and can get just the date or just the time, but not both.

TEXT(CreatedDate)


I'm trying to create a button on a child record that will give the user the option to go back to the parent record.  I created the following button and it's redirecting to the parent record but it's in edit mode.  I don't want it in edit mode I just want it to go to the parent.

/{!Information__c.UserContractId__c}/e?retURL=%2F{!Information__c.UserContractlId__c}
The parent record is a lookup to UserContract__c
The child record is AdditionalInfo__c

Any help is greatly appreciated.
I created a trigger to prevent the deletion of a parent record if a child record exists. I'm having problems with the test class. It says required field missing "Dept_Code__c". I have it in the test class, so I'm not sure what I'm missing.
Parent Object - Order_Request__c (Quantity, Cost Center (lookup), Order Type (lookup) are required fields.

Child Object - Order_Assignment__c (Order Request, Order Center (lookup) are required fields)

Any help is greatly appreciated.

trigger PreventOrderDeletion on Order_Request__c (before delete) {


    for(Order_Request__c lq : [Select Id, Name, (Select Id from Order_Assignments__r) from Order_Request__c where Id IN :trigger.oldMap.KeySet()]){

            if(lq.Order_Assignments__r != null && lq.Order_Assignments__r.size() > 0){

              lq.addError('The order request cannot be deleted because there is an associated order assignment record');

            }
     } 



@IsTest(SeeAllData=true)
public class PreventOrderDeletionTest{

static testMethod void PreventDeleteTest()
{
    //Create Parent Object
    Order_Request__c lic = new Order_Request__c(Name='Salesforce Testing');
    lic.Quantity__c = Decimal.valueOf('1.0');
    lic.Order_Type__c = 'a6xxxxxxxxxxxx';
    lic.Dep_Code__c = 'a6Oxxxxxxxxxxx';
    insert lic;

    //Start Test & create child object
    test.startTest();

    Order_Assignment__c asgn = new Order_Assignment__c();


    //Relate Child to the Parent from the inserted record above
    asgn.Order_Request__c = lic.Id;
    asgn.Dep_Code__c = lic.Default_Code__c;

    //Insert Child Record
    insert asgn;

    try {
    delete lic;
        } catch (Exception e) {
           system.assertEquals('You cannot delete this record!', e.getMessage());
          }
   //Stop Test
   test.stopTest();
}  
}