Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Script : Adding resources to appointment in VBS

Hi,

I'm using a VBS script to add an extra appointment (appnt) right after the creation of an appointment (currentappointment) in the WIndows Client version 8.0.x

I'm transferring participants from the original to the "copy" with this loop :

while counter < 4
 set personlist = currentappointment.GetParticipants( counter ) 'enPartTypeExtPerson
 for each person in personlist
  appnt.AddParticipant(person), false 
 next
wend

It works well, but I can't find a similar way to transfer resources (enPartTypeExtPerson = 4). Does anyone have a working solution or a pointer in the right direction?

RE: Script : Adding resources to appointment in VBS

I tried this:

    counter = 1
    While counter < 4
        Set objs = curAppnt.GetParticipants( counter )
        For Each obj In objs
            newAppnt.AddParticipant obj, vbFalse
        Next
        counter = counter + 1
    Wend

Works for me.
What version are you running.

You may also try the newer Clone method.

    Set newAppnt = curAppnt.Clone

This will clone everything.
Alter the date afterwards before saving...

conrad


Af: Conrad Weyns 8. dec 2017

RE: Script : Adding resources to appointment in VBS

Hi Conrad,

Thank you for the quick reply.

You're correct! Your example works and so does mine.

I was under the impression from the SDK that enPartTypeExtPerson needed to be 4 to get resources, but I must have misunderstood that.

I cannot get .clone to work at the moment, but that may be a whole bunch of other things. I'm stuck i syntax problems and endless restarts of the Windows client.

+1 from me to a "developer mode" where you can refresh scripts without reloading the client :)

Thank you for the help, I have a working solution now.

Af: Stig Meyer Jensen 8. dec 2017

RE: Script : Adding resources to appointment in VBS

Clone is "relatively new".. Hasn't realy been published yet but for Appointments it works well.

SInce you are complaining about endless restarts, I must conclude that you are not up to date.

Developer mode has been available for years! I made that as soon as I had to start working with COM & Scripting  - it is sheer hell otherwise :-)

Open Web.Admin/Preferences/Functions:

Restart SoCrm.
You should now see a Script utils menu.

Enjoy!

/conrad




Af: Conrad Weyns 8. dec 2017

RE: Script : Adding resources to appointment in VBS

Thank you very much. Script Developer mode is going to save us loads of time!

Af: Stig Meyer Jensen 8. dec 2017

RE: Script : Adding resources to appointment in VBS

Debugging in-process vbscripts in SoCrm is a challenge.
I had some success some years ago with SplineTech VBS Debugger.

See:

https://community.superoffice.com/en/developer/forum/rooms/topic/superoffice-product-api-group/crm-windows-application/debugging-in-process-vb-scripts/

I had to remove it after a while because it conflicted with Visual Studio.

My approach is to first develop the script as an external script using for example VBSEdit. Then port it to be an in-process script hooked to some event.

Conrad

Af: Conrad Weyns 8. dec 2017