Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

Need logic to get the count on the action button clicked and display it in the subject line

Need the logic for the below requirement

On a form there is a 'Re-Notify' button
When the user clicks on it, a mail notification is shot. This
'Re-Notify' button can be used any number of times. The aim here is, the 'Re-Notify' is used after a first notification is sent and there is no response from the user. So, when the 'Re-Notify' button is clicked for the first time, the subject line should contain the count as '2nd Notification', and for the secont time when the 'Re-Notify' button is clicked the subject line should contain '3rd Notification' and so on.  
0
shals0628
Asked:
shals0628
  • 5
  • 4
1 Solution
 
doninjaCommented:
When a response is created is it compsed as a response document to the main document, or just a new normal document ?
If responses then you could count the number of responses to a document that exist in a view.

if Response then make view that only shows response documents and the value of $ref field sorted.
Then get the main documents @documentuniqueID and use that to get count of all documents in view with this value;
Example.
@elements(@dblookup("";""";"viewname";@documentuniqueid;1;[FailSilent]))
0
 
Sjef BosmanGroupware ConsultantCommented:
Some clues:

Default NNotif:= 0;
Field NNotif:= NNotif + 1;
@MailSend( sendTo ; copyTo ; blindCopyTo ; "Notification #" + @Text(NNotif) ; remark ; bodyFields ; [ flags ] )

The last line is for you to fill in. See also the Designer Help Database.
0
 
shals0628Author Commented:
@doninja - Thank you for your response.  No, there is no response document here.
@sjef - Can you please tell me how to implement in lotus script?  I have tried this way, created a computed field of type number on the form with formula as @if(@isnewdoc;1;ReNotifyCtr) and once the button 'ReNotify' is clicked it calles a function from the Script Library -- I have added this following code in the function

Dim RNCtr As variant
RNCtr=chkdoc.ReNotifyCtr(0)
RNCtr=RNCtr+1
Call chkdoc.Replaceitemvalue("ReNotifyCtr",Cstr(RNCtr))

But I am getting error -- RNCtr is not getting set at all. Please help.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Sjef BosmanGroupware ConsultantCommented:
Why in Script? Or do you want to call a library function?

And why a computed field? Why don't you calculate it in the button, you don't need to define a field.

Dim RNCtr As Integer ' initialised as 0
If(chkdoc.HasItem("ReNotifyCtr") Then
      RNCtr= chkdoc.ReNotifyCtr(0)
End If
RNCtr=RNCtr+1
Call chkdoc.Replaceitemvalue("ReNotifyCtr",RNCtr)

Why is ReNotifyCtr a string??
0
 
shals0628Author Commented:
I am using the script as its remaining code is already present in script, so only this needs to be added.
If I initialise the counter=0 in the button, then each time the button is clicked the counter will get initialised to 0, I want the last count to be saved.  As the button 'ReNotify' will be available at all times.
0
 
Sjef BosmanGroupware ConsultantCommented:
Read my code, it reloads and saves the counter.

Make sure chkdoc is saved after executing the code.
0
 
shals0628Author Commented:
@sjef - I am getting 'Type Mismatch' error on line RNCtr=chkdoc.ReNotifyCtr(0).
0
 
Sjef BosmanGroupware ConsultantCommented:
Oh, that would be because you tried on a document you already tested with, and you saved a string in the field.


Dim RNCtr As Integer ' initialised as 0
If(chkdoc.HasItem("ReNotifyCtr") Then
      On Error Resume Next ' ignore errors
      RNCtr= CInt(chkdoc.ReNotifyCtr(0)) ' force integer
      On Error Goto 0 ' default error handling
End If
RNCtr=RNCtr+1
Call chkdoc.Replaceitemvalue("ReNotifyCtr",RNCtr)
0
 
shals0628Author Commented:
Can you please tell me on the form what should be the field type and formula for this? ReNotifyCtr ?
0
 
Sjef BosmanGroupware ConsultantCommented:
You don't need a field on the form. But if you absolutely want one, create a computed field, with formula
      ReNotifyCtr
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now