MyChat Scripts Engine: mGetWebSupportGroupIDByName
Function to get a numeric ID of a WEB support group by name.
Syntax
function mGetWebSupportGroupIDByName(sName: string): integer;
Parameters and return values
| Parameter | Type | Value | 
| sName | string | group name; the letter case does not matter. | 
Function result
| >0 | function executed successfully; the result is a numeric ID for a group; | 
| -1 | group with such name is not found. | 
Example
var
  i, iID: integer;
  Groups: array[1..3] of string;
  s: string;
begin
  Groups[1] := 'MyChat Web Support';
  Groups[2] := 'Developers';
  Groups[3] := 'Sales Department';
    for i := 1 to 3 do begin
      iID := mGetWebSupportGroupIDByName(Groups[i]);
      s := 'Web support group "' + Groups[i] + '" ';
        
        if iID = -1 then s := s + 'is not found'
          else s := s + 'has ID = ' + IntTostr(iID);
          
      mLogScript(s, '');    
    end;
end.
Script work result
[14:41:12] (Log "mGetWebSupportGroupIDByName"): Web support group "MyChat Web Support" has ID = 1
[14:41:12] (Log "mGetWebSupportGroupIDByName"): Web support group "Developers" has ID = 2
[14:41:12] (Log "mGetWebSupportGroupIDByName"): Web support group "Sales Department" is not found
[14:41:12] (Run "mGetWebSupportGroupIDByName"): Script operation time: 3 ms
[14:41:12] (Run "mGetWebSupportGroupIDByName"): Script done successfully.