<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Set fields value with user function</title><link>https://www.infopathdev.com:443/forums/thread/4342.aspx</link><pubDate>Thu, 29 Mar 2007 12:34:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4342</guid><dc:creator>stumbler</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4342.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=4342</wfw:commentRss><description>Thanks all,&lt;br /&gt;&lt;br /&gt;Shiva, I used your suggestion an got it to work.&lt;br /&gt;Anyhow I find it a pity it is so hard to get AD information into infopath with jscript. On the Web you can find dozens of snippets to address this info through VBscripting. But nothing for jscript.</description></item><item><title>Re: Set fields value with user function</title><link>https://www.infopathdev.com:443/forums/thread/4341.aspx</link><pubDate>Thu, 29 Mar 2007 12:18:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4341</guid><dc:creator>B.Shiva Prasad</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4341.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=4341</wfw:commentRss><description>Hi stumbler,&lt;br /&gt;&lt;br /&gt;if in jscript try this, its working.&lt;br /&gt;&lt;br /&gt;var oNet = new ActiveXObject("Wscript.Network");&lt;br /&gt;XDocument.DOM.SelectSingleNode("my:myField/my:field1") = oNet.UserName;&lt;br /&gt;</description></item><item><title>Re: Set fields value with user function</title><link>https://www.infopathdev.com:443/forums/thread/4340.aspx</link><pubDate>Thu, 29 Mar 2007 06:54:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4340</guid><dc:creator>chang</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4340.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=4340</wfw:commentRss><description>The code line&lt;br /&gt;&lt;br /&gt;XDocument.DOM.SelectSingleNode("my:myField/my:field1").text = System.Environment.Username;&lt;br /&gt;&lt;br /&gt;is mixing 2 programming languages together with each other. System.Environment.Username is .NET code, not JScript, so unfortunately it will not work.</description></item><item><title>Re: Set fields value with user function</title><link>https://www.infopathdev.com:443/forums/thread/4339.aspx</link><pubDate>Wed, 28 Mar 2007 14:16:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4339</guid><dc:creator>stumbler</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4339.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=4339</wfw:commentRss><description>I tried with 'XDocument.DOM.SelectSingleNode("my:myField/my:field1").text = System.Environment.Username' and get the errormessage:  'system not defined'&lt;br /&gt;:(</description></item><item><title>Re: Set fields value with user function</title><link>https://www.infopathdev.com:443/forums/thread/4338.aspx</link><pubDate>Wed, 28 Mar 2007 03:59:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4338</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4338.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=4338</wfw:commentRss><description>Hi Hans,

That code is indeed for JScript, you just need to capitalize DOM.  The only way I can think of how to do this with rules is with our Active Directory web service.  Assuming you have AD, you can issue a GetMyInfo call and it will download all info about the current user into a secondary DOM in your form.  Once this is done, you can simply copy the correct field from the 2DS into the Main DOM.

Here&amp;#39;s the link if you want to check it out: &lt;a href="http://www.qdabra.com/en/products/ADWebService.aspx"&gt;http://www.qdabra.com/en/products/ADWebService.aspx&lt;/a&gt;&lt;br /&gt;</description></item><item><title>Re: Set fields value with user function</title><link>https://www.infopathdev.com:443/forums/thread/4337.aspx</link><pubDate>Tue, 27 Mar 2007 14:03:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4337</guid><dc:creator>stumbler</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4337.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=4337</wfw:commentRss><description>Sorry for my incomplete mail but I work with Infopath2003 and I am using Jscript.&lt;br /&gt;The code you suggest I guess is for VBscript is it not? anyhow, I get an error 'system not defined'&lt;br /&gt;I like to fill in the information only when they click the 'approve' button  so I hoped I could enter a user function in the 'rules' part of the control.&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: Set fields value with user function</title><link>https://www.infopathdev.com:443/forums/thread/4336.aspx</link><pubDate>Tue, 27 Mar 2007 13:34:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4336</guid><dc:creator>nukkumatti</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4336.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=4336</wfw:commentRss><description>okay let's say you have a textbox control on your form named field1.&lt;br /&gt;&lt;br /&gt;Now go to tools - programming - and select OnLoad event in the menu bar.&lt;br /&gt;&lt;br /&gt;Now you can use:&lt;br /&gt;XDocument.Dom.SelectSingleNode("my:myField/my:field1").text = System.Environment.Username;</description></item><item><title>Set fields value with user function</title><link>https://www.infopathdev.com:443/forums/thread/1936.aspx</link><pubDate>Tue, 27 Mar 2007 13:23:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1936</guid><dc:creator>stumbler</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1936.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1936</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;Is it possible to set a fields value with a user definied function?&lt;br /&gt;I have a function to get the users login name (Called: GetUserName). I would like to pass that to a field in my form. The function resides in my form code.&lt;br /&gt;&lt;br /&gt;How can this be done?</description></item></channel></rss>