• Ian Sidle
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
This is a very specific request, so I will try to include  simplified code/data structure to demonstrate. 
 
I am trying to clone records with parent-child lookup fields and use an external id so they can be inserted into the database simultaneously (vs having to insert parent first and then populate id into child).  

Data Model
ObjectA__c
External Id Field ExtId__c
 
ObjectB__c
Lookup Field to ObjectA called LookupA__c
 
Code 
//Make example records the regular way
ObjectA__c ExampleA=new ObjectA__c();
insert ExampleA;
system.debug(ExampleA); //Output = ObjectA__c:{Id=a6A540000000A4uEAE}

ObjectB__c ExampleB=new ObjectB__c();
ExampleB.LookupA__c=ExampleA.id;
insert ExampleB;
system.debug(ExampleB); //Output = {LookupA__c=a6A540000000A4uEAE, Id=a6B540000004SCaEAM}
 
//So far, so good….
 
//Try clone and use foreign key insert
List<Sobject> ToInsert = new List<SObject>();
 
ObjectA__c NewA = ExampleA.clone(false,true,false,false);
NewA.ExtId__c='NewA';
system.debug(NewA); //Output = ObjectA__c:{Extid=NewA}
ToInsert.add(NewA);
 
ObjectB__c NewB= ExampleB.clone(false,true,false,false);
System.debug(NewB) //Output = {LookupA__c=a6A540000000A4uEAE}
NewB.LookupA__c=null; //Trying to make this empty
NewB.LookupA__r=null; //Really Trying to make this empty
System.debug(NewB) //{LookupA__c=null} //Looks empty to me

NewB.LookupA__r=new ObjectA__c(Extid__c='NewA');
System.debug(NewB) //{LookupA__c=null} //Still Looks empty
ToInsert.add(NewB);

insert ToInsert; //FATAL_ERROR System.DmlException: Insert failed. First exception on row 1; first error: INVALID_FIELD, Cannot specify both an external ID reference LookupA__r and a salesforce id, LookupA__c: []
 
Questions
How do  I un-specify the lookupA__c?
It is pre-populated by the clone operation and setting it to null doesn't seem to count. 
Am I missing a step somewhere?
Is there a undocumented way to tell clone to exclude the LookupA__c field or something?
 
I am trying to avoid making my own clone method (getdescribe and copy values) or use multipule DML operations.
 
I have contacted our acocunt manager at the ISV (Steelbrick) and they said we need to create a case with you before it can be resolved.

Since we do not have a prmier plan, support told me I had to start here with the request before I can get assistance (even though it is impossiable for anyone outside of salesforce support to address the issue).

1. Unexpected Error
The package installation failed. Please provide the following information to the publisher:
Organization Name: Gigamon
Organization ID: 00D180000000mPU
Package: SteelBrick CPQ
Version: 22.0
Error Message: The post install script failed.
According to the documentation (http://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_feeditem.htm), the title field has the property "Filter" which should means a query can filter it but that's not working in practice. Either the documentation is wrong or there is a bug with the system.

Type :string
Properties :Create, Filter, Group, Nillable, Sort
Description: The title of the FeedItem. When the Type is LinkPost, the LinkUrl is the URL and this field is the link name.

Steps to reproduce:
1)Open up WorkBench 
2)Enter the SOQL query "SELECT Id,Title FROM FeedItem WHERE title!=null LIMIT 100" and click Query
3)Get Error message "Field 'title' can not be filtered in query call"

I initally submitted a case about this bug and was told that since we only have standard support, I have to report the issue here. 
This is a very specific request, so I will try to include  simplified code/data structure to demonstrate. 
 
I am trying to clone records with parent-child lookup fields and use an external id so they can be inserted into the database simultaneously (vs having to insert parent first and then populate id into child).  

Data Model
ObjectA__c
External Id Field ExtId__c
 
ObjectB__c
Lookup Field to ObjectA called LookupA__c
 
Code 
//Make example records the regular way
ObjectA__c ExampleA=new ObjectA__c();
insert ExampleA;
system.debug(ExampleA); //Output = ObjectA__c:{Id=a6A540000000A4uEAE}

ObjectB__c ExampleB=new ObjectB__c();
ExampleB.LookupA__c=ExampleA.id;
insert ExampleB;
system.debug(ExampleB); //Output = {LookupA__c=a6A540000000A4uEAE, Id=a6B540000004SCaEAM}
 
//So far, so good….
 
//Try clone and use foreign key insert
List<Sobject> ToInsert = new List<SObject>();
 
ObjectA__c NewA = ExampleA.clone(false,true,false,false);
NewA.ExtId__c='NewA';
system.debug(NewA); //Output = ObjectA__c:{Extid=NewA}
ToInsert.add(NewA);
 
ObjectB__c NewB= ExampleB.clone(false,true,false,false);
System.debug(NewB) //Output = {LookupA__c=a6A540000000A4uEAE}
NewB.LookupA__c=null; //Trying to make this empty
NewB.LookupA__r=null; //Really Trying to make this empty
System.debug(NewB) //{LookupA__c=null} //Looks empty to me

NewB.LookupA__r=new ObjectA__c(Extid__c='NewA');
System.debug(NewB) //{LookupA__c=null} //Still Looks empty
ToInsert.add(NewB);

insert ToInsert; //FATAL_ERROR System.DmlException: Insert failed. First exception on row 1; first error: INVALID_FIELD, Cannot specify both an external ID reference LookupA__r and a salesforce id, LookupA__c: []
 
Questions
How do  I un-specify the lookupA__c?
It is pre-populated by the clone operation and setting it to null doesn't seem to count. 
Am I missing a step somewhere?
Is there a undocumented way to tell clone to exclude the LookupA__c field or something?
 
I am trying to avoid making my own clone method (getdescribe and copy values) or use multipule DML operations.
 
I have contacted our acocunt manager at the ISV (Steelbrick) and they said we need to create a case with you before it can be resolved.

Since we do not have a prmier plan, support told me I had to start here with the request before I can get assistance (even though it is impossiable for anyone outside of salesforce support to address the issue).

1. Unexpected Error
The package installation failed. Please provide the following information to the publisher:
Organization Name: Gigamon
Organization ID: 00D180000000mPU
Package: SteelBrick CPQ
Version: 22.0
Error Message: The post install script failed.

Hello,

 

I have created a VF page that will go on a public site that is meant for user to enter data into the system.  This is working fine but I noticed that URL hacking is possible (read only due to FLS on the public user profile for the site) if a user appends the id to the url (for example, VFPage?id=00AB0000001abcD).

 

Ideally, I would like to simply set FLS to edit with no view.  Since create FLS requires view FLS, how can one prevent url hacking in this manner?   How can we prevent the controller extension from processing data from the url?

 

Thanks,

 

Tony