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
RKRK 

SControl Length Limit? For creating multiple custom objects from a WIL

Hey all,
I currently have a custom object that represents a piece of marketing material (i.e. a flyer, brouchere, etc).  These marketing materials need to be approved by the banks in which they are to be distributed, and to help disseminate the approval information, I created a relationship object that is displayed via a related list on the marketing Material object.

The user that maintains the marketing materials has 15 banks (which are accounts) that will automatically approve any material that we develop.  Rather than make her create 15 different relationship objects (called "Marketing Material Approvals") I developed an SControl to auto create the 15 relationship objects.

Essentially, I just took an SControl that would create a single relationship and copied it the code for the SControl multiple times - one for each bank.

THe SControl works, but it stops after creating the relationship for 2 or 3 banks.  I have found that if I move those banks that have the shortest names to the top of the code that it will create more of the relationship objects before it stops, leading me to beleive that I have hit a limit of some sort.

Any thoughts?   This would be quite the time saver for my user..

Thanks, as always.
LT


<script language="Javascript">
function redirect()
{parent.frames.location.replace('/a0F/e?retURL=%2F{!Marketing_Material__c.Id}&CF00N40000001UJyK=    "Webster Bank"&CF00N40000001UJz3={!Marketing_Material__c.Name}&00N40000001UK0G=Approved&save=1');
}
redirect();
</script>
<script language="Javascript">
function redirect()
{parent.frames.location.replace('/a0F/e?retURL=%2F{!Marketing_Material__c.Id}&CF00N40000001UJyK=    Linsco/Private Ledger (LPL)&CF00N40000001UJz3={!Marketing_Material__c.Name}&00N40000001UK0G=Approved&save=1');
}
redirect();
</script>
<script language="Javascript">
function redirect()
{parent.frames.location.replace('/a0F/e?retURL=%2F{!Marketing_Material__c.Id}&CF00N40000001UJyK="My First Account Name"&CF00N40000001UJz3={!Marketing_Material__c.Name}&00N40000001UK0G=Approved&save=1');
}
redirect();
</script>
<script language="Javascript">
function redirect()
{parent.frames.location.replace('/a0F/e?retURL=%2F{!Marketing_Material__c.Id}&CF00N40000001UJyK=    "My Second Account Name"&CF00N40000001UJz3={!Marketing_Material__c.Name}&00N40000001UK0G=Approved&save=1');
}
redirect();
</script>
<script language="Javascript">
function redirect()
{parent.frames.location.replace('/a0F/e?retURL=%2F{!Marketing_Material__c.Id}&CF00N40000001UJyK=    "My Third Account Name"&CF00N40000001UJz3={!Marketing_Material__c.Name}&00N40000001UK0G=Approved&save=1');
}
redirect();
</script>

Message Edited by RK on 01-14-2007 06:23 AM

michaelforcemichaelforce

RK,

Cutting and pasting like you have done is not going to work for a number of reasons, the first of which that I see is that you then have multiple functions with the same name.  The second problem, is that this browser directing method of creating objects is definitely not the way to go.  You should use the 'create' call via the ajax toolkit.  You could then create an array of 'bank_relationships__c' or whatever you have named your custom object, and then create all 15 with just one API call.

Hope this helps.

RKRK

Good morning Michael,

Thanks for the reply!  Although the answer that your provided was the answer I thought I was going to get, it was not the answer that I wanted to get.

If you weren't able to tell by my code sample or any of my prior posts on other topics, I am a hack.  I am not given enough time in my "regular" job to do a deep learn into programming (be it Ajax, JavaScript, etc) as it is not part of my core responsibilities nor do I have enough time at home to learn it (my 2.5 year old daughter doesn't like me on my laptop much :smileyhappy:)

I tend to learn by reverse engineering code that I find and then recode it through trial and error to fit my needs.  That being said, does anyone have any sample code that might perform a similar function that I could tear apart and rebuild?  I learned MS SQL by this method, and although I'm not terribly proficient, I can do pretty much everything I need to do in that app.

Humbly yours,

RK

michaelforcemichaelforce

RK,

Hanging out with family is always a better alternative to programming :smileyhappy:.

I have sent you a 'private message' so we can discuss in more detail.

-Michael