I want to run one script on my custom object say obj__c which will update 1 field of this object. This object obj__c is having a trigger on update which I don't want to run when my script runs.
11742
How can we disable triggers, Validation Rules and workflow rules in salesforce org.  This becomes really needed and important when we are doing data migration(data imports) in salesforce.  The way I handled this is create a custom label and include it in workflow and validation rule logic.   example - Custom label 'Disable workflow' = True then do not fire workflows.            if its False then fire workflow  But wanted to understand if there is any more efficient way to handle these scenarios.
34277
I need to create an edit component for an SObject from which I do not know the objectApiName at design time. I only know the Id of the SObject. objectApiName could be any valid SObject-name.  Now I want to use lightning:inputField   This needs to be wrapped by lightning:recordEditForm  In case I hardcode it to "Order", provide a vaild Order Id and let the controller load the order and assign it to the Parent-attribute, this works flawlessly:  &lt;aura:attribute name="recordId" type="String" default="" /&gt; &lt;aura:attribute name="Parent" type="SObject" default="{}" /&gt; &lt;aura:attribute name="ParentType" type="String" default="" /&gt; &lt;b&gt;{!v.ParentType}({!v.recordId})&lt;/b&gt; &lt;br/&gt; &lt;lightning:recordEditForm recordId="{!v.recordId}"  objectApiName="Order"&gt;     &lt;lightning:messages /&gt;     &lt;lightning:inputField fieldName="Name" /&gt;     &lt;lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update" /&gt; &lt;/lightning:recordEditForm&gt;   It looks like below and even the Update-button works as expected and saves the record:    But what I really want is  &lt;lightning:recordEditForm recordId="{!v.recordId}"  objectApiName="{!v.ParentType}"&gt;   Note the {!v.ParentType} instead of the hardcoded "Order"  As an great unfortunate, this only collapses to that error-popup    In the screenshot you see, that the ParentType is correctly bound to v.ParentType (right above the button) which a I also verify in the console  Suspicion  I set the ParentType-attribute as a result of APEX call (asynchronously). This seems to be too late for the lightning:recordEditForm. It tries to render with objectApiName at a time where it is still blank, hence it crashes during initialization...  Question  Is there a clean way to avoid this and get something to fly with an dynamic objectApiName?  Trying to use $A.createComponents()  As @sfdcfox suggested I jump on the $A.createComponents() which turned indeed out to be tricky, exactly as sfdcfox has predicted. Im following this .  Added a button to the markup    Added a handler to the js-controller:  makeEdit : function(cmp, evt, hlp) {      console.log('ParentId :: ', cmp.get("v.ParentId") );      console.log('ParentType :: ', cmp.get("v.ParentType") );      $A.createComponents([             ["lightning:recordEditForm",{                 "recordId"          : cmp.get("v.ParentId"),                 "objectApiName"     : cmp.get("v.ParentType"),             }],             ["lightning:inputField",{                 "fieldName" : "Name"             }]         ]         ,function(components, status, errorMessage){             if (status === "SUCCESS") {                 var wrapper         = components[0];                 var inner           = components[1];                 wrapper.set("v.body", inner);             }             else if (status === "INCOMPLETE") {                 console.log("No response from server or client is offline.")                 // Show offline error             }             else if (status === "ERROR") {                 console.log("Error: " + errorMessage);                 // Show error message             }         }     ); },   Now I can press the button - but nothing - I repeat: n o t h i n g - gets rendered at all. What is my fault here? Note that the console.log get output and the attribute are holding good values.
34714
When editing I want to be able to change the attributes of one field and upon doing this allow for the automatic update of another field in the same attribute table.   Essentially I have one layer with a code, description and legend information.   I would like to be able to edit the code and have the description and the legend information update with this edit with its correct description and legend information.   Is there any way to do this within ArcMap's tools or an associated script?
3543
I am trying to create an Apex Trigger that performs a Rollup from a custom object to Contacts.   Here is the error that I am receiving:      Didn't understand relationship 'Assignments__r' in FROM part of query   call. If you are attempting to use a custom relationship, be sure to   append the '__r' after the custom relationship name. Please reference   your WSDL or the describe call for the appropriate names.   The child relationship name is Assignments.  Below is the code:      trigger RollupActiveAssigmentLevelsToContact on pse__Assignment__c (after insert, after update, after delete) {      set&lt;Id&gt; set_id = new set&lt;Id&gt;();      List&lt;Contact&gt; con_list = new List&lt;Contact&gt;();      if(trigger.isInsert || trigger.isUpdate){         for(pse__Assignment__c myAssignment : trigger.New) {             set_id.add(myAssignment.pse__Resource__c);         }     }     else if(trigger.isDelete){         for(pse__Assignment__c myAssignment : trigger.Old){             set_id.add(myAssignment.pse__Resource__c);         }     }      if(trigger.isAfter &amp;&amp; (trigger.isInsert || trigger.isUpdate || trigger.isDelete)){         con_list = [SELECT id,Total_Levels__c, (SELECT id,name FROM Assignments__r WHERE Active_Assignment__c = TRUE) FROM Contact WHERE id IN :set_id];          for(Contact con : con_list){             if(con.Assignments__r.size()&gt;0)                 con.Total_Levels__c = con.Assignments__r.size();             else                 con.Total_Levels__c = 0;         }         if(!con_list.isEmpty())         update con_list;     } }   Below is a snap of the Child Relationship name:
43815
So I found this python script on another post here and was trying to adjust it for my needs.  I'm a very novice python user so I'm struggling with how to modify the script.  I have a Feature Class stored in a feature Dataset that I want to search a field for duplicate values and populate a new field with Y for duplicate or N for none.  The below script is what I found that looks like it will work once I find a way to drill down into my file geodatabase.          from arcpy import *          inShapefile = pointsShapefile          checkField = "xyCombine"         updateField = "dplicate"         #List of values found once         occursOnce = []        #list of values found twice         occursTwice = []       cursor = da.SearchCursor (inShapefile, [checkField])           for row in cursor:           #Check value is not null        if row[0]:     #If not already found to occur twice, proceed     if not row[0] in occursTwice:         #If hasn't occured once yet         if not row[0] in occursOnce:             #Add to occurs once list             occursOnce.append (row[0])         #If value has already been found once         else:             #Add to occurs twice list (duplicates)             occursTwice.append (row[0])     del cursor       cursor = da.UpdateCursor (inShapefile, [checkField, updateField])      for row in cursor:       #Check value is not null         if row[0]:            #check if value in occursTwice list (i.e. is duplicate)     if row[0] in occursTwice:         row[1] = "Y"     else:         row[1] = "N"     cursor.updateRow(row)    del cursor
90062
I have Opportunity-lookup field on Opportunity (self),  Scenario:   Opportunity A if select Opportunity B using lookup then Opportunity B's same lookup field automatically populate with Opportunity A.   I tried to achieve this using trigger - before insert/update but its failing as:  System.DmlException: Update failed. First exception on row 0 with id 006G000000DHaBlIAL; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 006G000000DHaBl) is currently in trigger Oppy_before_INSUPD, therefore it cannot recursively update itself: []
22754
I have some code that relies on field history tracking by querying the History for a custom object. This works fine, but it appears that the history records aren't created during the test so none of my tests will pass.
449
I keep getting the following error when i try to drag and drop a script to my gameobject:    I have made sure that both my Script name and the class name is : Soldier as you can see:  public class Soldier : MonoBehaviour {     public int Rank; }   So my question is what have i done wrong?
95834
I have an approval process on a Custom object and also two custom buttons on the same record.  Once the record goes into the approval process, it gets locked. During that period, I want to disable/hide the two custom buttons.  How can I check if the record/custom object is locked or not using Apex?  And how can I disable/hide the buttons?
30678
Currently, I have an object on the scene, and one in prefab. I want the prefab's script to reference to the object on the scene through the   public GameObject obj;   code. However, when I tried to add the object in the editor, I cant seem to be able to select any objects from the scene, only ones in prefabs.  I am quite new at unity, so am I missing something really basic here?   Thanks for any help!
88953
Is there a good tool that checks the schema to determine custom fields and their use in triggers, page layouts, classes, etc? We have a couple objects that are getting close to the 500 max and it would be nice if there were a better way than having someone get a list of custom fields for an object manually and then searching every page layout, class, and trigger for use of each field.
80061
I'm using a flow to set a field to a certain value (01, 02, 03) depending on the value of another field on the same record. I initially wanted to do it with process builder but because of the mapping it seems I would need three 'criteria nodes' or a formula field. Furthermore, it seems Salesforce is recommending using flows instead of process builder for before update actions as it is faster.  The problem with Flows is that I found a way to trigger it when the record is new or updated but not when the specific field is changed so it triggers every time the whole record is updated even when the field stay the same.  On Process Builder, you can use isChanged and then call the flow with specific record but that kinds of defeat the point of using flows for before Update.  So is there a possibility to do the same thing directly in flow ?  Thank you for the help !
91021
trigger AccountReplicate on Account (after delete, after insert, after update) {     if ( trigger.isInsert ) {         for ( Account acc : trigger.new ) {             AccountOne__c ac = new AccountOne__c();             ac.Fax__c = acc.Fax;             ac.Phone__c = acc.Phone;             ac.Name =acc.Name;             insert ac;         }     }      if ( trigger.isUpdate ) {         integer  i = 0;         list&lt;AccountOne__c&gt; a2 = new list&lt;AccountOne__c&gt;([SELECT Id                                                         FROM AccountOne__c                                                         WHERE Name =: trigger.old[i].Name ]);         for ( AccountOne__c c1 : a2 ) {             c1.Name = trigger.new[i].name;             c1.Fax__C = trigger.new[i].Fax;             c1.Phone__C = trigger.new[i].Phone;             i++;         }         update a2;     } }   I tried bulk trigger for the update operation, but it's not working can anyone help me?
99911
I wrote the following trigger and I'm getting the error :     Illegal assignment from Schema.SObjectField to String   But I don't know how to fix it. I wrote a similar trigger before and didn't have any issues.   trigger AccountDuplicates on Account (before insert, before update) {  for (Account myaccount : Trigger.new) {         List &lt;Account&gt; dupes = [SELECT Name FROM Account WHERE Name = :(myaccount.Name)];          if (dupes.size() &gt; 0) {            myaccount.Duplicate_Account__c = Account.name;         }     } }   The purpose of the trigger - when a new account is created that matches the name of an existing account, put the existing account's name into the "Duplicate Account" field.
13296
I don't want to use /Application.../blender -P my_script.py but I want to tell a running Blender process to execute a script.   Is there an existing method to tell a running Blender process to execute a python script?  For example using http://localhost:123/run_script=myscript.py
78345
Code  trigger CreatePerson on Contact (before insert) {     RecordType personAccountRecordType =  [SELECT Id FROM RecordType WHERE Name = 'Person Account' and SObjectType = 'Account'];      Map&lt;Contact, Account&gt; accounts = new Map&lt;Contact, Account&gt;();    for(Contact record: Trigger.new) {        if(record.AccountId == null) {            Account newPersonAccount = new Account();            newPersonAccount.FirstName = record.FirstName;            newPersonAccount.LastName = record.LastName;            newPersonAccount.RecordType = personAccountRecordType;             accounts.put(record, newPersonAccount);        }    }     insert accounts.values();     for(Contact record: Trigger.new) {        if(record.AccountId == null) {            record.AccountId = accounts.get(record).Id;        }    } }   Error  Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Can not select a person account".   How can I associate the recently created Person account with the Contact?
20439
I am trying to get this trigger to work but it is giving me an error and I am not able to figure out why. The error I am getting is "attempt to de-reference a null object)  Why trigger? We have a Destinations object which is linked to Supplier products object via a lookup relationship. There are two types of supplier products(marketplace and curated) We want to count the number of live Supplier products and put them in a separate fields(live counts for each type).  I have gotten so far to actually count the number of live products and it is giving me an error. Can any one help? I am posting the code below  Trigger code :   trigger NoOfLiveProducts on Supplier_Product__c (after insert, after Delete, after update, after undelete) {       set&lt;string&gt; destinationids = new set&lt;string&gt;();      if(trigger.isInsert) {         for(Supplier_product__c products : Trigger.new) {             destinationids.add(products.Destination__c);         }     } else if(trigger.isDelete) {         for(Supplier_product__c products : Trigger.old) {             destinationids.add(products.Destination__c);         }     }else if(trigger.isUnDelete) {         for(Supplier_product__c products : Trigger.new){             destinationids.add(products.Destination__c);         }      } else if(trigger.isUpdate) {         for(Supplier_product__c products : Trigger.new) {             destinationids.add(products.Destination__c);         }     }      if(destinationids.size() &gt; 0){         Productcounter pc = new Productcounter();         pc.updateproductCount(destinationids);     }    }   Class code :  public class Productcounter {      public void updateproductcount(set&lt;string&gt; productIDs) {           if(productIDs == null){                return;         }          if(productIDs.size() == 0){             return;         }           list&lt;Supplier_Product__c&gt; ProductList = new list&lt;Supplier_Product__c&gt;();         ProductList = [Select ID,Destination__c                     From Supplier_Product__c                     Where Destination__c = :productIDs];          integer totalCount;         map&lt;string, integer&gt; DestinationIDToProductCountMap = new map&lt;string, integer&gt;();                for(Supplier_product__c ProductItem : ProductList){             if(DestinationIDToProductCountMap.containsKey(ProductItem.Destination__c)){                 totalCount = DestinationIDToProductCountMap.get(ProductItem.Destination__c);             }else{                 totalCount = 0;             }             totalCount += 1;             DestinationIDToProductCountMap.put(ProductItem.Destination__c, totalCount);         }          list&lt;Destination__c&gt; DestinationUpdateList = new list&lt;Destination__c&gt;();         Destination__c DestinationTemp;         for(string ProductID : DestinationIDToProductCountMap.keySet()){             DestinationTemp.ID = ProductID;             DestinationTemp.No_of_Live_Curated_Products__c = DestinationIDToProductCountMap.get(ProductID);             DestinationUpdateList.add(DestinationTemp);         }         if(DestinationUpdateList.size() &gt; 0){             update DestinationUpdateList;         }           }           }