Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

When you want the data from a UI Part Metadata Item and you're working in JavaScript, the Aptify JavaScript API provides a handy interface.

Step-by-step guide

  1. Know the Table Name you want to access – not the Name of the UI Part Metadata Item itself, but of one of its Tables that has Include In Data Set checked.

    Code Block
    languagejs
    linenumberstrue
    var upmiTable = "entityCards";
  2. Call Aptify.framework.utility.cache.getMetaData and use the UI Part Metadata Item in the callback.

    Code Block
    languagejs
    titleAccess a UI Part Metadata Item
    linenumberstrue
    Aptify.framework.utility.cache.getMetaData(upmiTable, function (data) {
    	// If we end up in the callback, we know that we've succeeded
    	// data holds the JSON array tied to the upmiTable key
    });

    So, for the Entity Cards array, which has a JSON UI Part that looks like this:

    Code Block
    languagejs
    titleEntity Cards UI Part Metadata Item JSON
    linenumberstrue
     {"entityCards": 
    	[	{"id":"1","name":"Persons Default", ..., 

...

  1. 
    		 "uiParts":
    			[	{"id":"1","entityCardId":"1", ...}
    			]
    		},
    		{"id":"2","name":"Companies Default", ..., 
    		 "uiParts":
    			[	{"id":"2","entityCardId":"2", ...}
    			]
    		},
    		...
    	]
    }

    The "data" parameter passed to the callback function will look like this:

    Code Block
    languagejs
    titleJSON Array From getMetaData()
    linenumberstrue
    [	{"id":"1","name":"Persons Default", ..., 
    	 "uiParts":
    		[	{"id":"1","entityCardId":"1", ...}
    		]
    	},
    	{"id":"2","name":"Companies Default", ..., 
    	 "uiParts":
    		[	{"id":"2","entityCardId":"2", ...}
    		]
    	},
    	...
    ]
    Note

    Because getMetaData() is a function that accesses the cache, it's possible for it to return synchronously if the requested metadata is already in the browser's local storage:

    Code Block
    languagejs
    titleSynchronous Use of getMetaData()
    linenumberstrue
    var data = Aptify.framework.utility.cache.getMetaData(upmiTable); 

    However, you as the programmer are not in control of the cache, so the best practice is to stick to using the function asynchronously.

Filter by label (Content by label)
showLabelsfalse
max5
spacesRD
sortmodified
showSpacefalse
reversetrue
typepage
labelsaptify-javascript-api nonvisual-javascript-api ui-part-metadata-item