User Tools

Site Tools



Create/Replace Group (snippet)

by: Gregory Haynes, November 2018
description: snippet to store a group regardless whether it already exists or not

The idea was to use Group.StoreGroupReplace(Handles.GetTitanIdFromHandle(…)) to record a group regardless whether it already exists or not, but this doesn't work.

There are distinct functions:

  • if a group does not exist then Group.StoreGroup stores the group (but would fail if it already exists)
  • if the group already exists then Group.ReplaceGroupOnHandle replaces (but won't if the groups does not exist)
I don't think there is a single function which would do both replacing and storing as in most cases the software will return an error if it cannot do exactly what you have asked rather than make an assumption. What you would probably have to do is determine yourself whether the group already exists and then call the correct function, you should be able to do this using the Group.CheckIfGroupExists function.


affected properties

control structures


<step>Group.CheckIfGroupExists(999.0, "Group.Numeric.IsValid")</step>
<step condition="Math.IsEqual(Group.Numeric.IsValid, True)">Group.ReplaceGroupOnHandle(userNumber:999)</step>
<step condition="Math.IsEqual(Group.Numeric.IsValid, False)">Group.StoreGroup(userNumber:999)</step>


This explains the functional steps within the sequence. For all the other XML details please refer to Formats and syntax

This checks if a particular group already exists, and then calls the correct function to store or replace the group.

How to use it

Snippet only, to explain how the functions work.

You could leave a comment if you were logged in.
macros/example/createreplacegroup.txt · Last modified: 2019/03/09 18:40 by icke_siegen