Onload Event - onetime onload

I currently have a field called multiplier on the opportunity form.  I am 
using the Onload event of the form to autopopulate the field with the value 
of 50, however I need this to be a one time load. For example, if the user 
creates a new opportunity I need the multiplier field to autopopulate with 
the value or 50.  HOwever, if the user changes the value and brings up the 
form again we need it to maintain the new value and not populate again with 
50.  I currently do not see a way of doing this.

Thanks for the help!
0
Utf
11/10/2006 9:34:02 PM
crm 35858 articles. 1 followers. Follow

4 Replies
634 Views

Similar Articles

[PageSpeed] 31

You can use the FormType to do that:


//Undefined Form Type = 0
//Create Form = 1
//Update Form = 2
//Read Only Form = 3
//Disabled Form = 4
//Quick Create Form = 5
//Bulk Edit Form = 6

if ((crmForm.FormType == 1) || (crmForm.FormType == 5)) {
    //make sure your field is on the form, which may not be the case in a 
quick create form
    if (crmForm.all.your_field != null) {
        crmForm.all.your_field.DataValue = 50;
    }
}


-- 
Michael

Web: http://www.stunnware.com/crm2
Feed: http://www.stunnware.com/crm2/atom.aspx

----------------------------------------------------------

"MDV1457" <MDV1457@discussions.microsoft.com> schrieb im Newsbeitrag 
news:9CF0F1DF-CCB5-4EF6-8383-A9A79AFC6711@microsoft.com...
>I currently have a field called multiplier on the opportunity form.  I am
> using the Onload event of the form to autopopulate the field with the 
> value
> of 50, however I need this to be a one time load. For example, if the user
> creates a new opportunity I need the multiplier field to autopopulate with
> the value or 50.  HOwever, if the user changes the value and brings up the
> form again we need it to maintain the new value and not populate again 
> with
> 50.  I currently do not see a way of doing this.
>
> Thanks for the help! 


0
Michael
11/10/2006 9:54:43 PM
Is there any particular reason you are choosing to auto-populate the field 
rather than just set "50" to be the default value through the field's 
attribute settings?  If not, it would probably be easier to just do it that 
way.

Otherwise, the only way I can think of is to have part of the onload script 
check the value of the field before acting.  Something to the effect of:  if 
'multiplier' does not equal 50, run; else, end.

"MDV1457" wrote:

> I currently have a field called multiplier on the opportunity form.  I am 
> using the Onload event of the form to autopopulate the field with the value 
> of 50, however I need this to be a one time load. For example, if the user 
> creates a new opportunity I need the multiplier field to autopopulate with 
> the value or 50.  HOwever, if the user changes the value and brings up the 
> form again we need it to maintain the new value and not populate again with 
> 50.  I currently do not see a way of doing this.
> 
> Thanks for the help!
0
Utf
11/10/2006 10:02:02 PM
Thanks Chad and Michael.  Michael, I will give this a go.  thank you very much

Chad, the field data type is a float.  I do not see of a way to set the 
default attribute on this. My understanding is that you can only set the 
default value (via customization manager for picklists...unless I'm missing 
something)

Thanks again!


"Chad Fulda" wrote:

> Is there any particular reason you are choosing to auto-populate the field 
> rather than just set "50" to be the default value through the field's 
> attribute settings?  If not, it would probably be easier to just do it that 
> way.
> 
> Otherwise, the only way I can think of is to have part of the onload script 
> check the value of the field before acting.  Something to the effect of:  if 
> 'multiplier' does not equal 50, run; else, end.
> 
> "MDV1457" wrote:
> 
> > I currently have a field called multiplier on the opportunity form.  I am 
> > using the Onload event of the form to autopopulate the field with the value 
> > of 50, however I need this to be a one time load. For example, if the user 
> > creates a new opportunity I need the multiplier field to autopopulate with 
> > the value or 50.  HOwever, if the user changes the value and brings up the 
> > form again we need it to maintain the new value and not populate again with 
> > 50.  I currently do not see a way of doing this.
> > 
> > Thanks for the help!
0
Utf
11/10/2006 11:45:02 PM
Michael,
This works great.  

Thank you very much!

"Michael Höhne" wrote:

> You can use the FormType to do that:
> 
> 
> //Undefined Form Type = 0
> //Create Form = 1
> //Update Form = 2
> //Read Only Form = 3
> //Disabled Form = 4
> //Quick Create Form = 5
> //Bulk Edit Form = 6
> 
> if ((crmForm.FormType == 1) || (crmForm.FormType == 5)) {
>     //make sure your field is on the form, which may not be the case in a 
> quick create form
>     if (crmForm.all.your_field != null) {
>         crmForm.all.your_field.DataValue = 50;
>     }
> }
> 
> 
> -- 
> Michael
> 
> Web: http://www.stunnware.com/crm2
> Feed: http://www.stunnware.com/crm2/atom.aspx
> 
> ----------------------------------------------------------
> 
> "MDV1457" <MDV1457@discussions.microsoft.com> schrieb im Newsbeitrag 
> news:9CF0F1DF-CCB5-4EF6-8383-A9A79AFC6711@microsoft.com...
> >I currently have a field called multiplier on the opportunity form.  I am
> > using the Onload event of the form to autopopulate the field with the 
> > value
> > of 50, however I need this to be a one time load. For example, if the user
> > creates a new opportunity I need the multiplier field to autopopulate with
> > the value or 50.  HOwever, if the user changes the value and brings up the
> > form again we need it to maintain the new value and not populate again 
> > with
> > 50.  I currently do not see a way of doing this.
> >
> > Thanks for the help! 
> 
> 
> 
0
Utf
11/11/2006 12:01:01 AM
Reply:

Similar Artilces:

Error
Hi Running Exchange 2003 on Windows 2003 server. We get these error msgs regularly and want to know how to find what is causing it. Also KB article 268831 discusses this but only for Exchange 2000. Is it the same solution for Exchange 2003.?? The event msgs are Event Type: Warning Event Source: MSExchangeIS Mailbox Store Event Category: General Event ID: 1025 Date: 04/03/04 Time: 4:35:31 PM User: N/A Computer: APOLLO Description: An error occurred on database "First Storage Group\Mailbox Store (APOLLO)". Function name or description of problem: EcGenerateReadReport: Function n...

Form OnLoad event for Case Entity not firing?
Hi, Is there something different about the Case entity that prevents a Form onLoad event from firing? I put an alert() call in there and it doesn't fire. I even typed garbage in the event handler and it doesn't error. Other entities like activity seem to work fine. Actually, I can't ge the onSave or the onChange events for any Case fields to fire either.... Thanks for you help! Todd Very interesting - I have the exact same problem with the Opportunity entity in CRM 4.0 Are you using CRM 4.0? Did you upgrade from 3.0? I did fix this for while by importing clean out of the ...

How can I create my own events?
I need a class to send events to a dialog window I have created "Chris Baker" <ChrisBaker@discussions.microsoft.com> wrote in message news:AA81315F-8765-4CF3-AC01-526FF4FADBC0@microsoft.com... > I need a class to send events to a dialog window I have created > CDialog MyDialog; MyDialog.SendMessage(MessageNumber, wParam, lParam); class MyClass { public: MyClass(CWnd *Target); private: void DoSomething(); CWnd *m_TargetWindow; }; MyClass::MyClass(CWnd *Target) { m_TargetWindow = *Target; } void MyClass::DoSomething() { m_TargetWindow->SendMess...

MSExchangeDSAccess Event 2061
Every 20 minutes we get the following error event: Event Type: Error Event Source: MSExchangeDSAccess Event Category: LDAP Event ID: 2061 Date: 1/17/2006 Time: 8:34:18 PM User: N/A Computer: AUSTIN2K3 Description: Process MAD.EXE (PID=2084). An LDAP search call failed - Server=<server fqdn> Error code=80040957. Base DN=, Filter=(legacyExchangeDN=), Scope=2. Running Windows 2003 SP1, AD + Exchange 2003 SP2 on the same server. Any clues? Thanks in advance. Alex. See if it helps: http://eventid.net/display.asp?eventid=2061&eventno=1784&source=MSExchangeDSAccess&...

installed office 2007, 2003 calendar events did not appear.
I had a error 1311 on installation of office 2007. The error solution was to uninstall office 2003 and reinstall 2007. Everything came up fine except calendar. None of my events from 2003 showed up, however my reminder popups worked from the 2003 calendar. I can't find the name of the calendar file to try to reinstall. Thanks, Charlie The calendar is in your pst. Do you see the calendar if you use Folder list view? (Press Ctrl+6 to switch to the folder list. ) -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions...

I need the code for event procedure of text box
I have a Text Box whose record source is a field of a query. I want to update the query field upon 'change' What code do I need to put in the event procedure to do that? Are you sure about this, Bob? The Change event fires with each keystroke, so firstly, you might need to consider whether the data would be valid. For example, if the text box is bound to a Date/Time field, it would not be valid when you have only typed 3/ Similarly if it is bound to a Number field, it would not be valid at the point when you have only typed the negative sign. If you want to proceed, the idea ...

Close Form Event
I have a AC2003 bound form. The condition I'm trying to capture is if the user modifies any item on the form and they close the form without saving changes. Simple...right? I found out that Form_Close doesn't work so I tried the following code in the Form_Unload event and that isn't working either. It does not even trigger the event. Can someone please tell me what I'm doing wrong? I would be much appreciated. Private Sub Form_Unload(Cancel As Integer) If Me.btnSave.Enabled Then Dim strMsg As String strMsg = strMsg & "Save Chan...

Unload, Close, Deactivate. Which event is best?
Good afternoon Hoping for some quidance as to which event to use for an append query to a temp table. A little background: Currently the users enter all purchase order info via a main form (with PO Nbr and supplier info, etc..) and the purchase order details get entered into the subform. The user enters amount ordered, amount received and a calculated field shows whether there are any backorders or not. If there are any backorders, once they are received the user goes back into the Purchase order and changes the amount received. All this works fine except we have no idea as to whe...

OnLoad form position
While using CRM, I have created a number of custom entities. I know how to set the size using an onLoad script, but is there any way to move the for so that it opens and the user can see everything on the page, rather than opening so that half of the form is off-screen? Any ideas would be greatly appreciated. ...

onLoad User Error Message 10-11-07
I created a onLoad event on the Account entity that hides a few tabs and along with the navigation icons ("Services" and Marketing"). Everything works well, until I open the account form as a read-only form. To recreate the error message, I use the Account lookup, select an Account, then click on "Properties". The error message I receive states: "There was an error message with this fields customized event. Field: crmForm Event: onLoad Error: 'navService' is undefined" Any thoughts or suggestions? Also here is the script that I am using - forgive ...

Item Event Handling
Dear all, I'm writing a COM Add-in for OL 2000 to synchronize emails between OL and IMAP server. I want to handle events for every email item in every folder. For example, when user moves multiple mails from this folder to another one, how do I know what items have been moved? Thank you very much, Khoa Tran Each MAPIFolder has an Items collection. If you declare the Items collection WithEvents you can handle the ItemChange, ItemAdd and ItemRemove events. ItemChange and ItemAdd return an Item object that is the item being added or changed. ItemRemove doesn't supply the Item and ...

workflow event sink missing from Component Services
I have an instance of Exchange 2003 enterprise installed on win2k3 enterprise and I want to use Workfow Designer for exchange to create some event sinks. I was going thru the steps of setting up the appropriate permissions and a workflow account but ran into a snag when I didn't see the Workflow Event Sink entry under COM+ applications within the Component Services snapin. I've read that Exchange is supposed to put it there during installation however it obviously did not. I can't find anything that tells me how to put it there manually and that's why I'm here. How do I...

save() during Onload
Hi all, In our deployment, whenever an account is opened from CRM, it always checks the latest data of that account from a different DB. At the end of this operation the form is saved. But this save operation is done during the onload event. The strange thing is that, this save operation creates a new account. So, everytime an account is opened a new account is also created due to this save operation. I remove the save operation, everything is Ok, but in this situation, if the user tries to close the account form, a pop up box asks that "the data will be lost if you close this win...

Messages and Events
Visual Studio .net 2003 How can I, systematicaly, find what messages and events are associated with a control? Tlhanks in advance RTFM? Documentation is the best approach, particularly if you want a systematic approach. joe On Thu, 18 Aug 2005 09:25:05 -0400, "RG" <nobody@nowhere.com> wrote: >Visual Studio .net 2003 > >How can I, systematicaly, find what messages and events are associated with >a control? > >Tlhanks in advance > Joseph M. Newcomer [MVP] email: newcomer@flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.c...

Event ID: 5895
I am receiving the following error in my application event log, can anyone tell me what this is? and or how to fix the problem if there is one? ********************************************************* Event Type: Error Event Source: MSCRMDeletionService Event Category: None Event ID: 5895 Date: 12/12/2003 Time: 10:32:17 PM User: N/A Computer: ISLANDGUY Description: Error: Can't clean up the following tables: Activity. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. ********************************************************* This erro...

OnLoad Event Error
Hey All, My client is getting an odd error during the Account Form's OnLoad event. There's an extensive amount of JScript code in it, but all was working on the CRM Server during testing, but when the User open's the Account, they receive this Msg: Error: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. Part of the code queries a filtered view in the CRM db, could it be that some users do not have permissions for this view? Has anyone seen this before? Error seems to be from the ADO provider. Without the cod...

calling onSave from Onload
Hi Everybody I got a question regarding MS CRM 3.0. Is there anyway i can call onSave event from page onLoad Event. Any help appreciable. Regards -- Jaber You could, with crmForm.Save(); However, saving the form causes it to be reloaded, so you'll end up in an infinite loop. What are you trying to achieve ? -- David Jennaway - Microsoft Dynamics CRM MVP Web: http://www.excitation.co.uk "Jaber" wrote: > Hi Everybody > I got a question regarding MS CRM 3.0. > Is there anyway i can call onSave event from page onLoad Event. > Any help appreciable. > Regards &g...

W2K3 E2K3 SP1 Event ID 2107 & 2122
I am having a random problem with DNS connectiviity. Every so often a 2107 Event occurs, followed by a 2122 and than a bunch of 2107's. Process INETINFO.EXE (PID=1584). DSAccess failed to obtain an IP address for DS server RCSMASTER2.rcs.k12.in.us, error 11004. This host will not be used as a DS server by DSAccess. Process INETINFO.EXE (PID=1584). Error 0x8007000e occurred when DNS was queried for the service location (SRV) resource record used to locate a domain controller for domain rcs.k12.in.us The query was for the SRV record for _ldap._tcp.dc._msdcs.rcs.k12.in.us For info...

Dr. Watson error Event ID: 4097
I am getting Dr. Watson error for the store on a fairly regular basis now on one of my exchnage server application .I am using exchange 5.5 sp4.The AV in the server is running in API mode.The server also has remote agent for Veritas. The details are: Event ID: 4097 Source: DrWatson Type: Information Category: None Description: The application, exe\store.dbg, generated an application error The error occurred on 3/ 8/2005 @ 14:59: 0.997 The exception generated was c0000005 at address 0042466b What could be the problem ....Can anyone shed some light on this??... See if post-SP4 hot-fixes...

Public Folder Shared Calendar Event Owner
Anyone, Is there a way to identify who added an event to a public folder shared calendar? Right now I have one group that contains everyone that needs to add events to the calendar. Unfortunately the calendar doesn't show who, or when the event was added so it’s very hard to track those "colorful" events some of the employees have added. Thanks ISD Forgot to add my configuration information: Windows Server 2003 running Exchange Server 2003. ...

onload functions
hi all, in CRM onload can i add a button or function? if thiere a sample pls. thnx, you can write javascript to be performed on the OnLoad event. You cannot add buttons or menu items as far as I know. Dave "mr. pOoO" <mrpOoO@discussions.microsoft.com> wrote in message news:18EA4AAB-B8DF-4FD3-80F6-CF1496FF4B7C@microsoft.com... > hi all, > > in CRM onload can i add a button or function? > > if thiere a sample pls. > > thnx, > > > > > Assuming you are good with DHTML and find the right objects, you should be able to a...

Irritating entries in my event log
Hi all I hav exc2003 and xp pro clients and i have this irritating entry that keeps on coming up in the event log.Dies anyone know what is wrong or how i can fix this Craig Entry 1: Volume Shadow Copy Service error: Error creating the Shadow Copy Provider COM class with CLSID {3ad41ba8-06ce-4a6f-94b2-bc8cde6ab807} [0x80070005]. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Entry 2: Volume Shadow Copy Service information: The COM Server with CLSID {3ad41ba8-06ce-4a6f-94b2-bc8cde6ab807} and name SW_PROV cannot be started. [0x800...

Unload event
Hi, I want to write a code in the Unload event of a form that prevents the form from being closed if the field [escalated by] is null... Private Sub Form_Unload(Cancel As Integer) Cancel = IsNull(Me![escalated by]) End Sub -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Pietro" <Pietro@discussions.microsoft.com> wrote in message news:03505060-D23E-40B8-A32A-B60085F6C529@microsoft.com... > Hi, > > I want to write a code in the Unload event of a form that prevents the > form from being closed if the field [escalated ...

onLoad code does not persist
Hi, I want to copy the status reason to a custom field for auditing purposes when the status is open, therefore when the lead gets disqualified we will know what the status was when it was last open. I've added some code to onLoad,however when the lead is disqualified the value in the field does not persist. Here is my code, any help greatly appreciated. I have tried hitting save before disqualifying the lead. var stateText; var statusText; stateText = crmForm.all.statecode.SelectedText; statusText = crmForm.all.statuscode.SelectedText; if(stateText == "Open"){ crmForm...

Event ID 9097
My Exchange 2003 namespace has become unregistered in Windows Management Instrumentation on the system. Support article 288590 describes my problem exactly. However, the resolution posted in the article does not work for me. I get an error message relating to invalid namespace. Any help would be appreciated. ...