Problem with Script Updating

I am using a script to update the “1099 Type” field for Master Vendor table.  
The script basically is a basic if-then statement. This script is run “Before 
Document Commit” and it’s not updating correctly, its flip-flopping the 
results. When the script is set to run Before Document Commit I have the 
“Destination mapping” field “1099 Type” set to “Use Script”. Script below:
If SourceFields("Send 1099") = "N" Then
   DestinationFields("Options.1099 Type").Value = 1
Else
   DestinationFields("Options.1099 Type").Value = 4
End If
I have also tried this same script at the field level.
Any suggestions as to why the field is not being updated? Or what I am doing 
wrong?

-- 
Thanks for your help
0
GPNewbie (36)
5/6/2009 3:24:01 PM
greatplains 29623 articles. 6 followers. Follow

4 Replies
1809 Views

Similar Articles

[PageSpeed] 59

When you used it in the field level script, did you use DestinationFields, or 
did you use CurrentField.  I try to stick with CurrentField.

"GPNewbie" wrote:

> I am using a script to update the “1099 Type” field for Master Vendor table.  
> The script basically is a basic if-then statement. This script is run “Before 
> Document Commit” and it’s not updating correctly, its flip-flopping the 
> results. When the script is set to run Before Document Commit I have the 
> “Destination mapping” field “1099 Type” set to “Use Script”. Script below:
> If SourceFields("Send 1099") = "N" Then
>    DestinationFields("Options.1099 Type").Value = 1
> Else
>    DestinationFields("Options.1099 Type").Value = 4
> End If
> I have also tried this same script at the field level.
> Any suggestions as to why the field is not being updated? Or what I am doing 
> wrong?
> 
> -- 
> Thanks for your help
0
jed9769 (25)
5/6/2009 3:54:05 PM
I used currentfield.value.  That didn't work either.
-- 
Thanks for your help


"Jed Perlowin" wrote:

> When you used it in the field level script, did you use DestinationFields, or 
> did you use CurrentField.  I try to stick with CurrentField.
> 
> "GPNewbie" wrote:
> 
> > I am using a script to update the “1099 Type” field for Master Vendor table.  
> > The script basically is a basic if-then statement. This script is run “Before 
> > Document Commit” and it’s not updating correctly, its flip-flopping the 
> > results. When the script is set to run Before Document Commit I have the 
> > “Destination mapping” field “1099 Type” set to “Use Script”. Script below:
> > If SourceFields("Send 1099") = "N" Then
> >    DestinationFields("Options.1099 Type").Value = 1
> > Else
> >    DestinationFields("Options.1099 Type").Value = 4
> > End If
> > I have also tried this same script at the field level.
> > Any suggestions as to why the field is not being updated? Or what I am doing 
> > wrong?
> > 
> > -- 
> > Thanks for your help
0
GPNewbie (36)
5/6/2009 7:31:01 PM
Ok, 

A few things you may want to change:

1) Avoid Source fields separated with spaces. Instead on 'Send 1099', try 
'Send1099'.

2) Before Document Commit is the wrong place for this script. You need the 
event to happen at mapping time, not when IM is getting ready to write the 
data to the database. I suggest you read the IM User Guide, Chapter 20: Using 
Scripts, Section: Attaching Scripts to Integrations. Page 142.

The 'Before Document Commit' script runs once for each document, AFTER ALL 
OF THE DESTINATION FIELDS HAVE BEEN SET based on the selected rules, but 
before the document is actually inserted or updated. Which means that the 
only possible way to alter this field value is during the mapping process 
which happens with a field script. Hence the 'flip-flopping' you are 
experiencing.

3) Your script should look something like this -- with validations -- and it 
should be attached to the 1099 Type field under the Options collection:

Dim l_send1099

'note I am using no space for the field name
l_send1099 = SourceFields("yourSourceName.Send1099")  

If l_send1099 = "N" Then
   CurrentField = 1
Else
   CurrentField = 4
End If

-- 
Best regards,
--
MG.-
Mariano Gomez, MIS, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com
The Dynamics GP Blogster at http://dynamicsgpblogster.blogspot.com


"GPNewbie" wrote:

> I am using a script to update the “1099 Type” field for Master Vendor table.  
> The script basically is a basic if-then statement. This script is run “Before 
> Document Commit” and it’s not updating correctly, its flip-flopping the 
> results. When the script is set to run Before Document Commit I have the 
> “Destination mapping” field “1099 Type” set to “Use Script”. Script below:
> If SourceFields("Send 1099") = "N" Then
>    DestinationFields("Options.1099 Type").Value = 1
> Else
>    DestinationFields("Options.1099 Type").Value = 4
> End If
> I have also tried this same script at the field level.
> Any suggestions as to why the field is not being updated? Or what I am doing 
> wrong?
> 
> -- 
> Thanks for your help
0
MarianoGomez (3440)
5/6/2009 7:38:03 PM
just use "Currentfield = ........."  When using the Currentfield statement 
you do not need to specify the field name. This identifier is used in the 
field level scripts.
-- 
Richard L. Whaley
Author / Consultant / MVP 2006-2008
Documentation for Software Users

Get our Free Tips and Tricks Newsletter and check out our books at 
http://www.AccoladePublications.com



"GPNewbie" wrote:

> I used currentfield.value.  That didn't work either.
> -- 
> Thanks for your help
> 
> 
> "Jed Perlowin" wrote:
> 
> > When you used it in the field level script, did you use DestinationFields, or 
> > did you use CurrentField.  I try to stick with CurrentField.
> > 
> > "GPNewbie" wrote:
> > 
> > > I am using a script to update the “1099 Type” field for Master Vendor table.  
> > > The script basically is a basic if-then statement. This script is run “Before 
> > > Document Commit” and it’s not updating correctly, its flip-flopping the 
> > > results. When the script is set to run Before Document Commit I have the 
> > > “Destination mapping” field “1099 Type” set to “Use Script”. Script below:
> > > If SourceFields("Send 1099") = "N" Then
> > >    DestinationFields("Options.1099 Type").Value = 1
> > > Else
> > >    DestinationFields("Options.1099 Type").Value = 4
> > > End If
> > > I have also tried this same script at the field level.
> > > Any suggestions as to why the field is not being updated? Or what I am doing 
> > > wrong?
> > > 
> > > -- 
> > > Thanks for your help
0
info4071 (3004)
5/6/2009 10:33:01 PM
Reply:

Similar Artilces:

Intercept ShutDown Event in C# ? Problem with error code 0xC000014
Hi all, I am trying to write application which will intercept ShutDown event and then cancel that even do some backup work and then fire again shut down event. The problem I am facing is that after capturing shutdown event following line does not help me to cancel it completlly: System.Diagnostics.Process.Start(@"C:\WINNT\system32\shutdown.exe", "-a"); So ShutDown seems to be canceld but my application report error code 0xC0000142 in User32.dll, and can not proceed with backup operation. Is there any way to cancel shutdown event and that application have a...

Problem after Changing the Domain Admin password
After changing the password for the domain admin users cannot log into outlook but can open WEBMAIL. If i change the admin password back and restart the the Exhange services everyone can once again log into their outlook. It is Exchange 2000 on a windows 2000 server. The exchange services are set to use the local system account. Any suggestions. ...

Outlook Office assittant problem
hi all When i start and stop the outlook 2000, i am getting the following alert message "There are no Office Assistant character files present on the system. Please run setup in maintenance mode and install at least one character" but by clicking "Ok" , the outlook continues to work. what can be done for avoiding this alet? Thanks and redgs neela The program is asking that the original installation media be placed back in the machine, go to the add/remove applet in the control panel, highlight Office/Outlook 2000, and select Add/Remove. From there it wants y...

Parameter Query Problem 12-21-07
Hi, I'm creating a Paramater Query based on the date of a payment and receipt number for a record which includes 1st payment, second payment, and 3rd payment and 1st receipt number, 2nd receipt number, and 3rd receipt number fields. How do I retrieve only the field results which match the parameter criteria without pulling up other field values of that record which may not fit the search criteria? Thank you for any suggestions. I suggest that you change you table structure to something like this --- Payments --- PayID - autonumber Invoice - (could be SalesID - relates to sale &...

imap problems through front end
I am having problems with imap through the front end server. the front end server is in an dmz and back end in the private network. so a user from the public net tried imap through front end using outlook express and gets an error The requested name is valid, but no data of the requested type was found. any ideas? even ms support does not even know I dont want to have to relocate my front end server help please Hi Tony, Is the IMAP service running on the backend also? This is a requirement. If IMAP, POP, etc is running on the front end it also needs to be running on the back ...

Need help writing an update query
I'm not good at this so I need some help. Here's what I want to do. I have two tables with fields that need linked to add an update. To show what I want to do I have put the table and fields in brackets. Thanks. Here it is: If [Status Table:Status=Sold or No Bid] and [Status Table:Date=1/11/2008] then in [List Table:Publication Fee] enter [$30.00] On Tue, 22 Jan 2008 17:23:17 -0800, Rick <Rick@discussions.microsoft.com> wrote: >I'm not good at this so I need some help. Here's what I want to do. I have >two tables with fields that need linked to add a...

Inconsistent rule problem
I have a rule set up that automatically forwards specific emails as an attachment. The problem is that sometimes an email will come in the rule will send it off and then the email is marked as read, at other times it's marked as unread. Is there anyway to make sure that the email will read unread until I actually read it? -- ejames See my reply to your post in microsoft.public.outlook.general. -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgroup to preserve the message thread. *** "ejames"...

Getting a number to update
I have a form with a button that when clicked I would like to have it go to a file, get the number there, add one to it, and then save it back in that file as well as display it in the field on the form. I created a table for this number, but don't know how to program the button to do what I want it to do. The users need a new number only some of the time, and would then click the button. The number needs to be incremental by one. Would a query work best or an update? I am at a loss, please help. Thanks, First BackUp your data I assume that this table has only one record whi...

Problem loading outlook
Hi Guys Everytime I start Outlook 2003 I get the following error: A runtime error has occurred. Do you wish to debug? Line:297 Error: Class not registerd. If I click yes I am asked which Just-in-time debugger I want to use. I select Microsoft Script Editor 6.0 and get the following message: An excpetion of type 'Class not registered' was not handled and then the following is highlighted: document.all.dateScript.innerHTML = window.external.GetDate(); Any help please -- Thanks TJ Try a new mail profile. --� Milly Staples [MVP - Outlook] Post all replies to the group t...

gmail.com sending problem
hi... i am using a exchange server 2000 all mail send/receive is working properly but gmail.com domain sending problem when any user send mail to gmail domain users of gmail receives quiet late about after 10 hours. Any way to check why gmail domain problem quite late in queue. Thanks in advance If you look at the headers in GMail of a message that was sent from your domain, you should be able to tell from the time stamps where the delay is....once you know where, you can then focus on why... "Hyder Abbas" <Hyder Abbas@discussions.microsoft.com> wrote in message ne...

Outlook & OWA Language problem
We have a client running Outlook 2003 and IE 6 for OWA. Both clients have the inbox (and several other folders) in spanish. It should be in english. Have checked the local machines for different languages. (yes this happens on every machine she logs into and at home using OWA). We have already run: outlook.exe /ResetFolders outlook.exe /ResetFolderNames These switches did nothing. We also did a repair on the Office 2003 install, uninstalled office and reinstalled it...Still the same. The exchange servers do have anti-virus software running but it's not effecting the other 48,000+ users. ...

Phantom Mcafee Firewall after Updates to Vista 32 Bit Home Premium
Hi, I just installed a whole slew of updates for Vista 32 Bit Home Premium. Now I cannot access internet with my Zone Alarm suite enabled because windows claims Mcafee Firewall is also running. I have no currently installed McAfee components or products. I uninstalled the free versions that came preloaded on the laptop 2 years ago. How can I disable McAfee firewal when I do not even have it? Thanks. Hello Paul, Use the McAfee removal tool. McAfee Removal Tools/Instructions http://forums.mcafeehelp.com/viewtopic.php?t=71943 -=- "Paul F." wrote: ...

Problems downloading transactions #2
For some reason I can't download transactions for my Wells Fargo accounts through MS Money 2007 anymore. It seems that there were two options in the past, 1 was to download them through MS Money for free or 2, pay for Online banking with Wells Fargo which gives you bill pay. Wells Fargo said they don't support option 1 and it was done through MS Money. Is this option no longer available through Money? I recently had this problem pop up, too. Within the past week, whenever I try to download my information through MS Money (as I have for a few years) it has not permitted me to do so...

Summing problem
Hi I have have few columns which have several rows. Each column has been added up using the Sigma tool (S). When I try to add up ( = A+B+C...) those sums I end up with zero value no matter what I do? Any ideas? Thanks Kalevi Hi Kalevi, > I have have few columns which have several rows. Each column has been added > up using the Sigma tool (S). When I try to add up ( = A+B+C...) those sums I > end up with zero value no matter what I do? > Any ideas? > You mean =A10+B10+C10 ? (or =SUM(A10:C10)) Regards, Jan Karel Pieterse Excel MVP www.jkp-ads.com Just a guess .. Perha...

Sorting Problem 03-19-07
I deleted a previous question on this, but I now can't view the thread. Please accept my appology. I need to start again. Field: DBxInst: ([DBNum]*1000)+[Inst Num] Field: TheSortOrder: IIf([Forms]![boxSeatsForITI]![MySortOrder]=1,[BankName],[DBxInst]) The Sorting and Grouping window contains TheSortOrder. When MySortOrder = 1, the report is sorted correctly by [BankName]. When MysortOrder = 2, the report is not sorted by [BankName], nor is it sorted by [DBxInst], because the value of DBxInst is WRONG. But if I put [DBxInst] in the Sorting and Grouping window instead of MySortOrde...

Need count of updates after UPDATE query
Is there any way to get the count of updates after running this? strSQL = "UPDATE ..." currentproject.connection.execute strSQL On Fri, 15 Feb 2008 12:04:00 -0800, mscertified wrote: > Is there any way to get the count of updates after running this? > > strSQL = "UPDATE ..." > currentproject.connection.execute strSQL Look up the RecordAffected property in VBA help. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail ...

Strange CListCtrl Sorting problem
Hi All, Here is the situation. I have a list control that get's populated after the user selects an item from a combo box. Each time the user selects a new item from the combobox I remove all the items and add new ones. Now depending on the combo box item selected, the list needs to be sorted or not. So I have a m_Sort flag that get's set everytime the ComboBox selection is changed, and after I populate the CListCtrl I call SortItems if the m_Sort flag is set to true. If the first time I populate the CListCtrl and sort it, then everytime I clear it an add items they are all sorte...

WSAEPROVIDERFAILEDINIT problem from service
I run from service process with user rights (when user is logged) and in this process I create socket (CAsyncSocket::Create(port);). And I get WSAEPROVIDERFAILEDINIT error. When I run this process manually everything is ok. What is wrong? There are issues of server privileges involved. One thing you might try is to use other than the LocalService account to run the service. joe On Tue, 11 Oct 2005 17:37:45 +0200, ragi <ragi@agora.pl> wrote: >I run from service process with user rights (when user is logged) and in >this process I create socket (CAsyncSocket::Create(port)...

Problem re-loading Office 2003
I have a fully certified copy of Office 2003 which was working fine and no problems at all - but after the hard-drive failed on my Vaio pc - I had to use the emergency disc to recover the XP system after a new hard-drive was installed. All my old programmes loaded like a dream - except Office 2003 that started the set up and then an error message came up - Waiting for cabinets to be cached - then missing file L2561412 and set up failed. I trawled through the web to try and find a solution and someone suggested that this was because 2003 was not locating the CD drive to locate...

Problems with installing Outlook client user terminal server
Dear all, We are having problems installing the Outlook client on our Terminal service environment. The web client works great but when Outlook is started it crashes straight away and we get error messages in the server event log "There was a problem connecting to the authenticating server". Do you know the "log in" diference between CRM using Outlook and CRM using web client ? Is it possible that the system is trying to log into other services than the web client does typically ? ...

Outlook & Outlook Express
I have both loaded on my computer (Express was my original e-mail program). I successfully loaded Outlook and copied my contact list. I then set Outlook as the default. Nevertheless, I only get mail on O-Express, even though all my settings on Outlook, Outlook-Express list Outlook as the default. Mail settings on my control panel verify this. What's wrong??? Firstly with OE closed does OL send/receive OK ie send yourself a msg If OK, either delete mail accounts in OE, or set it to not check for mail. If you use OE (mail) and OL whichever is open will receive mail, assuming the ...

Problem with ExportAsFixedFormat with selected sheets
I have the routine below in a number of workbooks. Typically it works without a problem. I have a sheet with sheet names that I select and it exports the sheets to a PDF. For some reason sometimes it only produces a PDF with the first sheet in it instead of all sheetnames that were selected. I have made sure the sheetname array has more than one value and have also made sure (by exiting before the export) that it is selecting the correct sheets in a group. Both of those work fine. I have also made sure that there was not a problem with the SortableDateString fuction. If I manually select th...

0x800c0002 error when running windows update
I get this error when I try to install updates on a just loaded w2k pro sp4 machine. 0x800C0002 - Inet_E_Invalid_URL "mcsvcs" wrote: > I get this error when I try to install updates on a just loaded w2k pro sp4 > machine. > How do you correct this? I tried all of the things I could find(cleared tmp files, stop and started auto update, and restart). "Ǝиçεl" wrote: > 0x800C0002 - Inet_E_Invalid_URL > > > "mcsvcs" wrote: > > > I get this error when I try to install updates on a just loaded w2k ...

Solution to IE8/Google redirect problem
My Google search results were sending me to different webpages. I searched numerous forums for solutions. I used Spybot, Malwarebytes, HiJackThis, and other suggestions, with no success. Finally, I downloaded the free version of HitmanPro 3.5. HP3.5 identified atapi.sys as "Rootkit". Deleted and redirect problem went away. I hope this works for you! Hi, Have you rebooted since you Deleted and redirect problem went away? Rootkit infections usually aren't that easy to remove. Even a nuke and pave is not enough. Web search for rootkit infections You sho...

URL/link problems, isv.config, window.dialogArguments
Hi, I created a new webSite (and virtual directory) in the same server of CRM (3.0) but another port (I can´t keep CRM and my webSite in the same port). I changed the isv.config and add a button with a URL that link to page in my webSite: <ToolBar ValidForCreate="0" ValidForUpdate="1"> <Button Title="CORPORE --> CRM" Url="http://myServerNname:85/Corpore.NET/CRMMSIntegraAlunoCorporeCRMMSProcessando.aspx" PassParams="1" WinParams="dialogHeight: 400px; dialogWidth: 600px; dialogTop: px; dialogLeft: px; edge:...