• NikiV
  • NEWBIE
  • 50 Points
  • Member since 2007

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 50
    Replies

I am using Visualforce and APEX to save records for a Custom object Obj__c. I would like to add the recordtype in the save. Could someone tell me how to do so. Currently I am trying

Obj__c o = new Obj__c(f1__c = 'xxxx', f2__c = 'xxxx', RecordType.Name = 'xxxx');

Insert o;

I get some errorrs "Error: Compile Error: Invalid field initializer: RecordType.Name".

Please help me, how can I insert the recordtype name.

Thanks

KD 

  • June 04, 2009
  • Like
  • 0

If I'm on the Contact page and slect the "New Contact Donation", the donation shows up on the contact page......just like it's suppose to do. 

 

However, if clone that donation, it does not appear on the Contact tab?  Also, If i creat a donation from the donation tab, it doesn't appear on th Contact tab?

 

Any suggestions as to why?

 

I'm using Non Profit version...

Has anyone been able to implement dependent picklists on either web to case or web to lead pages?  I noticed that SFDC Support has dependent picklists when we generate a case, but it doesn't seem to be default functionality for customers.
  • May 13, 2009
  • Like
  • 0

Hello,

 

I've written a trigger on a custom object that updates a picklist field on a Contact record, and I have Person Accounts enabled.  The trigger works, updating the Contact only under the right circumstances.  I'm now trying to write a test method to move this into Prod and am having trouble updating a Contact record in the method.   Before the trigger is even fired I'm trying to set up my Contacts with the right information. 

 

Here is what my test method looks like so far, just setting up the initial Person Account contact:

 

// create person account by filling in the Account's lastname field.
Account a1 = new Account();
a1.lastname = 'Test1';
insert a1;
// now pull up Contact to set the value of my picklist field
Contact c1;
c1 = [select id, courses_completed__c from Contact where accountid = :a1.id];
c1.courses_completed__c = 'POE';
update c1;

 

At this point my method throws up a DML error on the update:

 

System.DmlException: Update failed. First exception on row 0 with id 003S0000002u36xIAA; first error: INVALID_CROSS_REFERENCE_KEY, Can not select a contact: [AccountId]

 

Any ideas on how to update a Person Account's contact fields in the test method?  I don't think I can update the contact field on my Account object - it comes up as invalid field when I access a1.courses_completed__c or a1.personcourses_completed__c.

 

Any thoughts would be much appreciated.  The API docs say you can't create or delete a Person Account type Contact but I should be able to update it.  The fact that my trigger works when I test it out in the UI points to an issue with the test method rather than my trigger coding.

 

Thanks!

  • January 29, 2009
  • Like
  • 0
I can't seem to access my new Junction object with the Excel Connector.  I have a custom object that has 1 Master-Detail relationship - I can see it with the Excel Connector in the Table Query wizard.  As soon as I add a second Master-Detail relationship field to this object, it disappears from the table list. 

Has anyone else had this problem?

BTW. This also happens in the Eclipse SDK and Crystal reports 2008, yet the Apex Data Loader still shows the object after adding the second M-D link.  Curious.

Niki
  • July 14, 2008
  • Like
  • 0
I have been trying to work with the new Junction object available since the Summer 08 release - an object with two Master-Detail relationships.  I cannot access this new object with a variety of API applications - Excel Connector, Crystal Reports 2008, Eclipse SDK.  I tested out 3 scenarios:
  1. Custom object with only 1 Master-Detail relationship - all applications show the object
  2. Custom object with 1 Master-Detail and 1 Lookup relationship - all applications show the object
  3. Custom object with 2 Master-Detail relationships - these 3 applications no longer show the object.

I've called into SFDC Support but so far this is not a known issue.  Has anyone else had success using a junction object with any of these commonly used applications?  The Apex Data Loader does show the junction object, which is very curious.

Would love to hear from anyone else having these issues as well.

Thanks
Niki


  • July 14, 2008
  • Like
  • 0
I am an independent SFDC consultant working in Vancouver BC and am looking for someone that has API/Java/AJAX coding skills.  Some of my clients are interested in S-Controls and integration to their website, which are skills I don't have.  Looking for a casual partnership where I could bring you in to work with my client on specific tasks.  I prefer someone based in lower mainland or Pacific time zone.
  • August 10, 2007
  • Like
  • 0
A couple of days ago I posted a similar question on the forums, I couldn't edit any exisitng apex class or trigger. I got an error message on eclipse:
 
 "Average test coverage across all Apex Classes and Triggers is 4%, at least 75% test coverage is required - line 1 Force.com code coverage warning"
 
so the solution was to create a sandbox and then upload the changes from there. Now, I could modify the code on the sandbox, but I cannot deploy it to the production org. I keep getting the same error. I am deploying to production via the ant, and even though the class I have modified has code coverage, it wouldn't let me deploy it. It keeps giving me the same error. 
 
Eclipse SDK 
v: 3.4.0
Build id: I20080617-2000 
 
Force.com IDE
v: Summer '09 (16.0.0) 
 
 
Trying to do it directly in the org (Setup > Develop > Apex Classes) I don't have the Edit | Del buttons, just the WSDL | Security ones. 
 
So I am completely locked, I can't do anything in the org. Is there a way to unlock it? Has this happened to someone before? 
  • September 25, 2009
  • Like
  • 0

Hello

 

I would like to configure my detail page so that it shows either a filtered related list or a report.  For instance, I am trying to have an "Upcoming Deals" block that shows opportunities filtered by close date.  What is the best way to go about this?  Will I have to create a VisualForce page?

Hey folks,

 

I have existing db schema in MS SQL Server 2005, and I want to create custom objects in Force.com from that tables. Do we have any utility/tools which creates custom Obejcts from existing relational tables?

 

This is urgent. Any help would be appreciated.

 

Regards,

Ankur

 

Message Edited by patelankurb on 06-15-2009 01:27 AM

Hi,

 

I have a problem in creating a validation rule.

 

I have a object called 'Defect'. Defect object has a field called Defect Status.

I want to apply a validation rule stating that whenever I enter a new defect(ie i press the save button) this Defect Status field should be auto generated and the value should be 'New'.

 

After this whenver I edit this Defect page. I shall get a drop down having the values - 'Closed, Fixed, Assigned'.

the drop down has a default value as New and has a drop with the above three values.

 

Please tell me how shall I accomplish this.

 

Regards

Diti

  • June 12, 2009
  • Like
  • 0

I work for a large multi-brnached organization and we have run out of custom fields on Contact and would like to use a corresponding custom object to hold more info. Before doing that, I want to make sure that there will be one and only one record on this new object for each Contact.  To that end, I've put together a very simple trigger to create a corresponding record in a custom object for each of our Contacts.

 

Everything works aside from populating the Contact__c lookup field on the custom object. I even repeated that command separately (not while making the new record) but it didn't work either. Any ideas on what's wrong?

 

 

trigger insertPIOPrec on Contact (before insert, before update) 
{
for(Contact c:Trigger.new)
{
If (c.PI_Ongoing_Participation__c == null){
PI_Ongoing_Participation__c p = new PI_Ongoing_Participation__c(Contact__c = c.Id);
p.Contact__c = c.Id;
insert p;
c.PI_Ongoing_Participation__c = p.Id;
}
else {}
}
}

 

Also, I'd like to upgrade the code to handle bulk inserts, but had a lot of difficulty figuring out how to do that.

 

Any help would be much appreciated.

 

Thanks,

David.

Hi -

 

I'd like to use the S-Control below to update a field on the Contact screen.  Can anyone provide some guidance on how it needs to be modified.  Thank you.  

 

David

 

//create an sobject
var myObj = new sforce.SObject("Contact");

//set the fields, note this is a merge field giving the ID of the current record
myObj.Id = "{!Contact.Id}";
myObj.Test__c = "Hope This Works"';

//call api
sforce.connection.update([myObj]);

 

 

 

I am using Visualforce and APEX to save records for a Custom object Obj__c. I would like to add the recordtype in the save. Could someone tell me how to do so. Currently I am trying

Obj__c o = new Obj__c(f1__c = 'xxxx', f2__c = 'xxxx', RecordType.Name = 'xxxx');

Insert o;

I get some errorrs "Error: Compile Error: Invalid field initializer: RecordType.Name".

Please help me, how can I insert the recordtype name.

Thanks

KD 

  • June 04, 2009
  • Like
  • 0

Hello,

 

I am new to salesforce and am currently browseing through the large number of tutorials here.

 

However, I was hoping someone could give me some pointers to help me resolve an immediate issue.

 

I have seen this issue raised elesewhere in the message boards, but there did not appear to be a clear resolution.

 

An email authentication rule was created to automatically send a reminder out when an opportunity 'expires', i.e., when a created field 'registration expires' becomes less than todays date.

 

Although this works fine for subsequently edited or created opportunities, and which were created BEFORE the rule and have not been edited since do not appear to trigger.

 

I have read from This Thread that this is because email rules do not apply retroactively to records, and only become 'linked' to the opportunity if is created or edited after the rule is created.

 

Unfortunatly, there appears to be a large number of opportunitues which are now not sending out reminder emails, far to many to go through and edit manually.

 

What I was hoping I could get help with is a way to query all the opportunitues and send out a template email to each that has exipired.

 

However, I have no idea where to start, or what terms to search for in the help.  Is this an S-Control, raw apex code or is there a way to mass edit/save the records to trigger the remider? How do I query the opportunties? Some sort of query then a 'foreach' loop maybe?

 

Many thanks,

 

Laurence

I'm new to salesforce development. I was wondering if any knew how to go about getting a data entry grid component for a form. i need it in a scroll pane so the user can enter in as many item number as needed. If someone has any direction it would be great.

 

 

I frequently have duplicate records when importing contacts into salesforce, and therefore, some of the contact information gets lost during the import. I know salesforce does not overwrite fields that are filled on already existing contacts, but is there a way to add information onto the end of an existing field?

 

We keep track of each contact's source, and if a contact shows up in more than one source I am looking for a way to see that. 

 

Any suggestions?

I've created two page layouts for an object and assigned them to two record types. I need to use the two different layouts in the New and Edit actions for the object. How can I use the record types that I created, in order to accomplish this?

 

Thank you for your help.

  • May 29, 2009
  • Like
  • 0

I'm going to try and write my order of actions and maybe then somebody can tell me that i'm missing something. What I am trying to accomplish is seperate web-to-lead's into 1 of three round robin assignment rules. The round robin rules function off of a custom object counter (1 for each rule)

 

-Form is filled out firing before insert trigger

-Trigger checks against a field entered from the form, logic is like this:

if x > 9, get the counter value for Large and save into custom lead field, set assignmentRuleID to rule1

 

if x > 3, get the counter value for Medium, save into custom lead field, set assignmentRuleID to rule2

else get the counter value for Small, save into custom lead field, set assignmentRuleID to rule3

 

Now the problem seems to be that the round robin assignment rules are based off of a formula field which is the MOD of the counter value stored in the lead. So if there are 5 people in my group and counter is 3 the mod value would be 2 meaning that the rule entry corresponding to that mod value would be called. But the leads are not being assigned at all. I'm thinking that since the rules are based off a formula value that maybe that value is not set because the lead has not really been saved yet. 

 

I know the trigger is being called and that it is going through my logic but the rules are not being applied at all.I can also see that the lead gets the correct counter value and that its mod value is calculated correctly and stored in the lead. 

 

Any help would be appreciated.

 

 

Hi,

 

I need to export all of our contacts in SF that have notes and attachments.  Is there a simple way to do this?

 

Thanks

 

Maureen Lamb

Zing Foundation

Hi,

 

I have a situation where I need to run .EXE file from the command line to generate a software license key for our products. I need to run the exe from salesforce after accepting input parameters from user.

 

Please let me know if there is way.

 

Thanks

 

 

 

 

  • May 06, 2009
  • Like
  • 0

Does anyone know if there is a way to schedule reports in SF? I'd like to have a report run and have the resultsin xl format emailed out to a manager on a weekly basis. Is this possible within SF? I created one report in SFDC.when I clicked on "arrow" symbol on Run Report button.It's not listing out me the available options.

 

Help me out. 

 

Thanks...

 

  • April 01, 2009
  • Like
  • 0
I want to send an email thanking the Primary Contact on an Opportunity when we mark the corresponding Opportunity Closed Won. But I don't see that object (Opportunity Contact Role) as an option when setting up the email alert.

Any suggestions?

Jane

  • October 24, 2008
  • Like
  • 0
Hi, I have a trigger that just needs to make two fields (Role__c and Product__c) unique for a given contact. When I try to write an error message I get the following System error.

'execution of BeforeUpdate caused by: System.Exception: SObject row does not allow errors:'. The code I am using is ...
Code:
trigger UniqueRoleProductTrigger on Contact_Role__c (before insert, before update)
{
if (Trigger.isBefore)
{
if (Trigger.isUpdate)
{
for (Integer i = 0; i < Trigger.new.size(); i++)
{
Contact_Role__c newRole = Trigger.new[i];

Contact curContact =
[select id, AccountId from Contact where id = :newRole.Contact_Person__c];

Contact_Role__c[] RoleProduct =
[select id, Product__c, Role__c from Contact_Role__c
where id = :newRole.Id];

for (Contact_Role__c r: RoleProduct)
{
if ((r.Product__c == newRole.Product__c) && (r.Role__c == newRole.Role__c))
{
r.addError('Role, Product pair already exists. Can not have duplicate Role-Product pair for the same contact.');
} //end of if statement


} //end of for loop
}
}//end if update
}
}

 I tried Trigger.new.addError as well, but still getting the error. Would greatly appreciate any help.

Thanks

  • January 14, 2008
  • Like
  • 0