Help with Lotus Notes 8 code

35 pts.
Tags:
Lotus Notes
Lotus Notes 8
Lotus Notes administration
I thought this would be simple but I can't seem to get it to work. In a form I have a button that calls an agent with the following code: @SetField("dspsupportingevidence";"test message"); @Command( [RefreshWindow] ); I want to collect information (do a survey) and put the information into the rich text field "dspsupportingevidence" in the form with the button (field exists).  The survey code I have for the button works ok.  I just can't seem to get the code above to change the field and display the changed info.  I got it to work once but don't know what I did. In the Agent properties I set Target to None to eliminate an error.

Software/Hardware used:
Lotus Notes 8
ASKED: July 8, 2011  1:16 PM
UPDATED: March 31, 2012  9:57 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

You may want to consider switching to LotusScript and usiing
Call notesUIDocument.Refresh( [ IncludeRichTextItems ] )

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Brooklynegg
    Refreshing a rich text field in a form UI takes special care. I have to agree with Stiletto. LotusScript is the answer. However, I would create a new richtextitem object, set it to your rich text field, populate the field, then Call an Update. set RTITEM = New Notesrichtextitem(doc, "dspsupportingevidence") 'populate the richtext item. 'YOUR CODE HERE 'then update RTITEM. Call RTITEM.Update
    3,845 pointsBadges:
    report
  • Rvogan
    I haven't learned LotusScript and it kinda frightens me. Maybe I should bite the bullet, but I'm under a time constraint. This is over my head and I think I'm going to have to abandon the project for now. Thanks Stiletto and Brooklynegg.
    35 pointsBadges:
    report
  • Brooklynegg
    Some thoughts. I'm kind of confused by the requirement. Why would you have someone respond to a survey, then push the data to a rich text field? Why not have the data save to the survey document and save the information there? If the end result is a requirement to show the survey answers on some other form, then display the survey results document in summary in an embedded view and use an embedded form to display the full survey document in the main form. This is all simple Notes stuff with no scripting required.
    3,845 pointsBadges:
    report
  • Rvogan
    thanks Brooklynegg. I'm not a Notes pgmr (no formal training) so I understand it at a high level but haven't done much actual coding. My team has a db we use for storing audit documentation. We want collect data from another team and store it in the db. The other team only has write access to some fields in the doc we intended to use. I tried to do a quick solution by putting a button in the doc with the following code to collect the data. Initially this was going to generate an email that would be sent back to a team mailbox. Then I tried to code the button to just update the field in the form directly.
    Sub := "Log Survey | ";
    
    REM {------------------------------------------Text for questions---------------------------------------------};
    
    Q1T := "Q1 text?";
    Q2T := "Q2 text?";
    Q3T := "Q3 text?";
    
    REM {------------------------------------------Y/N questions---------------------------------------------------};
    
    Q4T := "Q4 text?";
    Q5T := "Q5 text?";
    
    REM {-------------------------------------------Prompts-------------------------------------------------------};
    
    account := @Prompt([OkCancelEdit];"Account";"Enter the Account(s):";accountdef);
    
    Q1A := @Prompt([OkCancelEdit]; "Q1"; +Q1T; "");
    Q2A := @Prompt([OkCancelEditCombo]; "Q2"; +Q2T; "Daily" ; "Daily" : "Weekly" : "Monthly");
    Q3A := @Prompt([OkCancelEdit]; "Q3"; +Q3T; "");
    
    Q4A := @Prompt([OkCancelList] : [NoSort]; "Q4"; +Q4T; "Yes"; "Yes" :"No");
    Q5A := @Prompt([OkCancelList] : [NoSort]; "Q5"; +Q5T; "Yes"; "Yes" :"No");
    
    REM {--------------------------------------------Generate email------------------------------------------------------------------};
    
    atf := @Right(@Left(@UserName; "/");"=");
    firstname :=@Word(atf;" ";1);
    
    Subject := +Sub+account +" | " +Q1A+ " | " +Q2A +" | " +Q3A+" | " +Q4A+ " | "+Q5A+" | "+Q6A+" | "+Q7A+" | "+Q8A+" | "+Q9A+" | "+Q10A ;
    
    @SetField("hckrpt"; +subject;
    
    (etc)
    
    I think what you are saying is to create a new doc in the db which makes sense to me, but I haven't done that for a couple of years and would have to relearn it.  Also although I have the authorities to create docs I'm a little afraid of screwing something else up.
    
    In summary, I'm where I am because of my ignorance.  I have a hammer (familiar with the button and limited formula language) so everything looks like a nail.
    35 pointsBadges:
    report
  • Brooklynegg
    Well, if you have a hammer... Does this information have to go in a rich text field? Do you have a text field you can use instead (or add one)? If so, you could simply assign the field the final value. Also, you should create the full value of the field in a variable before assigning it. For instance, you could improve the look of the information by including the question, add line breaks, etc.. Then, if you change the button later, the question answered would display in the response. This also uses the common name component of @name to get the user's name, instead of parsing it out. I think that makes more sense as well. FinalValue := Q1T + ": " + Q1A + @newline + Q2T + ": " + Q2A + @newline + ... + @name([cn]; @username); @setfield("hckrptTXT"; FinalValue)
    3,845 pointsBadges:
    report
  • Rvogan
    Thanks again. That's what I was trying to do with the rtf. I didn't know a plain text field would act differently. When I do the setfield, the rtf is not updated and the refresh doesn't work for me. I was trying @setfield... @Command( [RefreshWindow] )... I had a death in the family and won't be able to play with it until next week. Thanks for your help
    35 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following