• Mike Schumacher 10
  • NEWBIE
  • 0 Points
  • Member since 2015
  • IT Applications Manager

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
In one of my sandboxes, when I try to add a call to an apex class from my process builder flow, I get an error 317755707.

The class is an invocable class.  My profile is set on the security for the apex class.  This happens with any process builder flow when trying to add a new action 'Apex'.  

I do not get this error in other sandbox and I do not get the error in my production org.  Just this one DEV sandbox.

Has anyone else receive this type of error and have a hint of what else I could check?

Thank you.
Mike S.
I have seen several examples posted on the internet to write my trigger on the contentdocumentlink object.  I noticed when the user types a new note in the lightning UI, the note is saved as the user types.

My trigger  on contentdocumentlink (after insert) was firing before the user had finished completely typing the note.
  • Is there a better approach how to  trigger for the new note-taking tool?
  • Is there a way to only execute after the user has clicked the 'Done' button on the new note?  This is the only time I know for sure the user is 'done' typing.

Thanks Mike
I was testing the enhanced notes in our sandbox and i noticed the insert  trigger is firing even before I finish typing.  As I type some more in the title or note body, the update triggers keep firing.  The dynamic saving as the user types is nice but I want to create a trigger to notify a specific group a new note has been added.

If I send the email notification on the insert, the new note is not complete and does not contain all the body text i entered.  The user will receive only a partial note.

How do others recommend approaching this situation?  I want to be able to capture the title and note body in an email.


Sample Trigger:
trigger Test_ContentDocument_Trigger on ContentDocument (before insert, before update, before delete,
    after insert, after update) {

    List<ContentDocument> cdRecords = trigger.new;
    ContentDocument cdRec = cdRecords[0];
    
    if(Trigger.isBefore && Trigger.isInsert) {
        System.debug('....before insert trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
    if(Trigger.isBefore && Trigger.isUpdate) {
        System.debug('....before update trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
        
    if(Trigger.isAfter && Trigger.isInsert) {
        System.debug('....before isInsert trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
    if(Trigger.isAfter && Trigger.isUpdate) {
        System.debug('....before isUpdate trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }


 
I am writing a VFP that will allow me to delete the records for a user from UserTerritory2Association and then insert a new list of territory associations.

When I click my 'save' button in my VFP it executes the routine saveTerritoryList as shown below.   The deleting of the current rows from User2TerritoryAssociation work ok.   As soon as I try to insert the new rows, I get the field is not writeable for userid and territory2id.   Any assistance is appareciated.

    public PageReference saveTerritoryList() {
        
        System.debug('in saveTerritoryList....');
        for (selectOption so : selectedTerritories) {
            System.debug('options--' + so.getValue() + '--' + so.getLabel());
        }
        
        //loop through the orig list of user territories and create a sObject
        //UserTerritory2Association with Id and then do a single delete.
        List<UserTerritory2Association> utList = new List<UserTerritory2Association>();
        for (SelectOption ut : origTerritoryList) {
            UserTerritory2Association ut2 = new UserTerritory2Association(Id=ut.getValue());
           
            //add the Id to the UserTerritory2Association list
            utList.add( ut2 );
            
        }
        //delete the current list of territories related to the user
        delete utList;

        //create a new list called utList2 to insert
        List<UserTerritory2Association> utList2 = new List<UserTerritory2Association>();
        for (SelectOption nt : selectedTerritories) {
            UserTerritory2Association ut2 = new UserTerritory2Association();
            
            Territory2 t2 = [select id,name from territory2 where
                            name =: nt.getLabel() limit 1];
            System.debug('t2 = ' + t2.Name);
            ut2.Id = nt.getValue();
            ut2.Territory2Id = t2.Id;
            ut2.UserId = userTerritoryObj.UserId;
            
            utList2.add(ut2);
        }
        insert utList2;
        
        return null;
    }

 
I was testing the enhanced notes in our sandbox and i noticed the insert  trigger is firing even before I finish typing.  As I type some more in the title or note body, the update triggers keep firing.  The dynamic saving as the user types is nice but I want to create a trigger to notify a specific group a new note has been added.

If I send the email notification on the insert, the new note is not complete and does not contain all the body text i entered.  The user will receive only a partial note.

How do others recommend approaching this situation?  I want to be able to capture the title and note body in an email.


Sample Trigger:
trigger Test_ContentDocument_Trigger on ContentDocument (before insert, before update, before delete,
    after insert, after update) {

    List<ContentDocument> cdRecords = trigger.new;
    ContentDocument cdRec = cdRecords[0];
    
    if(Trigger.isBefore && Trigger.isInsert) {
        System.debug('....before insert trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
    if(Trigger.isBefore && Trigger.isUpdate) {
        System.debug('....before update trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
        
    if(Trigger.isAfter && Trigger.isInsert) {
        System.debug('....before isInsert trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
    if(Trigger.isAfter && Trigger.isUpdate) {
        System.debug('....before isUpdate trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }


 
In one of my sandboxes, when I try to add a call to an apex class from my process builder flow, I get an error 317755707.

The class is an invocable class.  My profile is set on the security for the apex class.  This happens with any process builder flow when trying to add a new action 'Apex'.  

I do not get this error in other sandbox and I do not get the error in my production org.  Just this one DEV sandbox.

Has anyone else receive this type of error and have a hint of what else I could check?

Thank you.
Mike S.
I was testing the enhanced notes in our sandbox and i noticed the insert  trigger is firing even before I finish typing.  As I type some more in the title or note body, the update triggers keep firing.  The dynamic saving as the user types is nice but I want to create a trigger to notify a specific group a new note has been added.

If I send the email notification on the insert, the new note is not complete and does not contain all the body text i entered.  The user will receive only a partial note.

How do others recommend approaching this situation?  I want to be able to capture the title and note body in an email.


Sample Trigger:
trigger Test_ContentDocument_Trigger on ContentDocument (before insert, before update, before delete,
    after insert, after update) {

    List<ContentDocument> cdRecords = trigger.new;
    ContentDocument cdRec = cdRecords[0];
    
    if(Trigger.isBefore && Trigger.isInsert) {
        System.debug('....before insert trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
    if(Trigger.isBefore && Trigger.isUpdate) {
        System.debug('....before update trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
        
    if(Trigger.isAfter && Trigger.isInsert) {
        System.debug('....before isInsert trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
    if(Trigger.isAfter && Trigger.isUpdate) {
        System.debug('....before isUpdate trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }


 
I am writing a VFP that will allow me to delete the records for a user from UserTerritory2Association and then insert a new list of territory associations.

When I click my 'save' button in my VFP it executes the routine saveTerritoryList as shown below.   The deleting of the current rows from User2TerritoryAssociation work ok.   As soon as I try to insert the new rows, I get the field is not writeable for userid and territory2id.   Any assistance is appareciated.

    public PageReference saveTerritoryList() {
        
        System.debug('in saveTerritoryList....');
        for (selectOption so : selectedTerritories) {
            System.debug('options--' + so.getValue() + '--' + so.getLabel());
        }
        
        //loop through the orig list of user territories and create a sObject
        //UserTerritory2Association with Id and then do a single delete.
        List<UserTerritory2Association> utList = new List<UserTerritory2Association>();
        for (SelectOption ut : origTerritoryList) {
            UserTerritory2Association ut2 = new UserTerritory2Association(Id=ut.getValue());
           
            //add the Id to the UserTerritory2Association list
            utList.add( ut2 );
            
        }
        //delete the current list of territories related to the user
        delete utList;

        //create a new list called utList2 to insert
        List<UserTerritory2Association> utList2 = new List<UserTerritory2Association>();
        for (SelectOption nt : selectedTerritories) {
            UserTerritory2Association ut2 = new UserTerritory2Association();
            
            Territory2 t2 = [select id,name from territory2 where
                            name =: nt.getLabel() limit 1];
            System.debug('t2 = ' + t2.Name);
            ut2.Id = nt.getValue();
            ut2.Territory2Id = t2.Id;
            ut2.UserId = userTerritoryObj.UserId;
            
            utList2.add(ut2);
        }
        insert utList2;
        
        return null;
    }