Apex Designer Documentation
What's New
Getting Started
Business Objects
User Interfaces
App Behaviors
Project Settings
Patterns and Best Practices
App Showcase
Frequently Asked Questions

Creating An Angular Utility Service

Using an artifact in Apex Designer to specify defaults and reusable functions

Blank Profile Image
Written by Ashish Gupta
Updated 2 years ago
Less than a minute read

A custom Angular utility service can be used to create reusable scripts to use in your Apex Designer user interfaces.

Create a Service

To get started, add my-utility.ts file under /angular/src/app/shared/utilities. You can do this under the files option in the navigation ribbon on the left edge.

Add artifact dialog for angular service definition

Add the following code to this file:

// Creates a default utility object

export function myUtility(name: string) {

  var myUtilityObject = {
    name: name,
    date: new Date()

  return myUtilityObject;

At this point, your myUtility() function is ready to use in a User Interface. 

Access Service from a User Interface

In the Dependencies section of a User Interface, add "myUtility" as the "Name", select "Do not pass it to the constructor", and set "Imported From" as:


Dependency definition window for a service

You're all set to use myUtility in a User Interface Method:

let newUtility = myUtility("New Name");

debug('newUtility', newUtility);
Powered by Apex Designer
Terms of ServicePrivacy Policy
© 2017-2024 Apex Process Consultants