• Rachel van den Berg
  • NEWBIE
  • 20 Points
  • Member since 2016

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

Hi all,

I have written a trigger that blocks a user from deleting a record when it is created by a specific user:

trigger DoNotDeleteJobApplication on cxsrec__cxsJob_application__c (before delete) { if(System.Trigger.IsDelete && UserInfo.getProfileId().subString(0,15) != '00e58000000lWBJ') {     for(cxsrec__cxsJob_application__c ja: Trigger.old){     
    if(ja.CreatedById == Label.UserOwnerId) {            ja.addError('Je kunt de Inschrijving niet verwijderen, omdat dit een online Inschrijving is (kandidaat heeft via de website gesolliciteerd).');         }     } } }

 

Now I am struggling with the test class, how can I simulate that the job application is created by this specific user? I know I can create a user and run as this user but that does not help as I need the record to be created by a specific existing user. Anyone knows how to solve this?

Thanks!

 

Hi all,

I am quite new to triggers. Using the forum I was able to create a trigger to prevent delete based on a picklist value. Now I am trying to write a trigger that will prevent delete based on 'who' the record is Createdby. We do not want users to be able to delete records created by the site user. Unfortunately I am not able to figure this one out. Can anyone help with the code?

Thanks!

trigger  DeleteJobApplication   on  cxsrec__cxsJob_application__c(before delete){
if(system.Trigger.isDelete){
String Userid=[SELECT id,Name FROM User WHERE Id =:UserInfo.getuserid()].Name ;
    for(cxsrec__cxsJob_application__c  J:Trigger.old){
          if(J.Createdby == 'ResourceManager Profile' ){
             J.addError('Je kan de inschrijving niet verwijderen wanneer deze is gemaakt door de site user');
            }
     }
     }
     }

Hi all,

I have been trying to complete the challenge : Modifying Page Lay-outs but I keep getting the same error message: 

Challenge Not yet complete... here's what's wrong: 
The 'Phone Numbers' section was not found, or it was empty. If you believe that you have set this up properly and are still having problems, ensure that you are NOT using Record types for the Contact object. This challenge will not work with Record types so you will need to sign up for a new DE org and use that instead for this module.

There aren't any record types and I have already tried using a new DE org. Still get the same message.

Can anyone help out? 

Hi all,

I have written a trigger that blocks a user from deleting a record when it is created by a specific user:

trigger DoNotDeleteJobApplication on cxsrec__cxsJob_application__c (before delete) { if(System.Trigger.IsDelete && UserInfo.getProfileId().subString(0,15) != '00e58000000lWBJ') {     for(cxsrec__cxsJob_application__c ja: Trigger.old){     
    if(ja.CreatedById == Label.UserOwnerId) {            ja.addError('Je kunt de Inschrijving niet verwijderen, omdat dit een online Inschrijving is (kandidaat heeft via de website gesolliciteerd).');         }     } } }

 

Now I am struggling with the test class, how can I simulate that the job application is created by this specific user? I know I can create a user and run as this user but that does not help as I need the record to be created by a specific existing user. Anyone knows how to solve this?

Thanks!

 

Hi all,

I am quite new to triggers. Using the forum I was able to create a trigger to prevent delete based on a picklist value. Now I am trying to write a trigger that will prevent delete based on 'who' the record is Createdby. We do not want users to be able to delete records created by the site user. Unfortunately I am not able to figure this one out. Can anyone help with the code?

Thanks!

trigger  DeleteJobApplication   on  cxsrec__cxsJob_application__c(before delete){
if(system.Trigger.isDelete){
String Userid=[SELECT id,Name FROM User WHERE Id =:UserInfo.getuserid()].Name ;
    for(cxsrec__cxsJob_application__c  J:Trigger.old){
          if(J.Createdby == 'ResourceManager Profile' ){
             J.addError('Je kan de inschrijving niet verwijderen wanneer deze is gemaakt door de site user');
            }
     }
     }
     }

Hi all,

I have been trying to complete the challenge : Modifying Page Lay-outs but I keep getting the same error message: 

Challenge Not yet complete... here's what's wrong: 
The 'Phone Numbers' section was not found, or it was empty. If you believe that you have set this up properly and are still having problems, ensure that you are NOT using Record types for the Contact object. This challenge will not work with Record types so you will need to sign up for a new DE org and use that instead for this module.

There aren't any record types and I have already tried using a new DE org. Still get the same message.

Can anyone help out?