function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LogoJonLogoJon 

S-Control Help

    Hi all, It would probably drive you nuts that a Product guy who doesn't know how to code is snooping around the dev network, but i have a question about an s-control.

I have created some custom objects and need to map the field on one object to a field on another.

One custom object is named "Item"  It has a field called "Item Number".  I would like to get that Item Number to map to another custom object named "Line Item."

I do not know how to write code, but i can pick out the pieces.  This code would be very helpful as there are other places I need the same functionality. 

Can someone help me out? I would be much obliged.
LogoJonLogoJon
Oh, and I have multiple "Items" and many more "Line Items"  The Line Item will have a lookup field to the appropriate Item, but the "Item Number" that is populated on the Line Item needs to be mapped from the Item that has the relationship with that Line Item.
Angel118Angel118
Hi LogoJon,
                    Can u be more illustrative on this, as i have done something similar to this and can help u with this.

Angel..
LogoJonLogoJon
Angel,

Thank you for your help.  Here is a picture of what I need.  I changed it slightly... it is the exact same Idea, but the two custom objects are Vendor and Item.  On the Item object I created a lookup field to the Vendor.  In addition I need the Vendor # from the Vendor object to appear on the Item object.  See below, and thank you again:


KringoKringo
LogoJon

If you do not have it already get a copy of the Force.Com Cookbook. You can follow this link to get a digital copy.
http://www.apexdevnet.com/events/cookbook/registration.php

There is an example on page 124 of how to create a scontrol that will move the data over when you are creating
a new Item record from the Vendor record.

If you just want to use the relationships to pull related info I suspect this might involve some more advanced programming or Apex code.
LogoJonLogoJon
Thanks Kringo, but we will not be adding a new Item from the Vendor Object.  Anyone out there have a  suggestion?
Angel118Angel118
Hey LogoJon,
                       I have worked on such Control...

Just Change the book Placement detaisl to the object on which u want to update and the Book Details to the Object to where u want to fetch the values from....

<script type="text/javascript" src="/soap/ajax/9.0/connection.js" > </script>

<script type="text/javascript" >

 

 

var BookDetails  = sforce.connection.query("select Vendor_Details from Book__c (Vendor) where Name = '{!Book_Placement__c.Book__c}'");

 

 

var bookArray = BookDetails.getArray("records");

 

var BookRec =new sforce.SObject("Book_Placement__c");

 

BookRec.Id="{!Book_Placement__c.Id}";

 

if(BookDetails.size >) {

 

BookRec.Available_Copies__c = bookArray[0].Available_Copies__c;


 

if(sforce.connection.update([BookRec])[0].getBoolean("success"))

{

window.parent.location.href="{!URLFOR($Action.Book_Placement__c.View, Book_Placement__c.Id, null,true)}";

 }

else

{

alert("Problem in Updating the Book Details to Book Placement"); }

}

</script>



Rest all Same,
Angel..

Message Edited by Angel118 on 10-04-2007 12:14 PM