You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

BUI - getFieldValues Synchronously

Received Response
28
Views
6
Comments
edited Jun 7, 2022 1:07PM in General Technical Discussions 6 comments

Content

Hello,

Is there a way to make the code (below) wait for the Promise to complete and get the values before before it moves on (synchronously)?

- At the minute I would have to setup the getFieldValues and run the call to use the field within the getFields

- I want to obtain a field value mid-function and really want to wait for the field to be available without having to chain together lots of calls to make it work

Regards,

David

Version

18a

Code Snippet

             I want to do something like:

var field = "";
ORACLE_SERVICE_CLOUD.extension_loader.load("Sample")
.then(function(extensionProvider) {
	extensionProvider.registerWorkspaceExtension(function(WorkspaceRecord) {
		WorkspaceRecord.getFieldValues(['Incident.c$fieldX']).then(function(IFieldDetails) {
			field = IFieldDetails.getField('Incident.c$fieldX').getLabel();
		});
	});
});

// Use the value
field 


Instead of:
var field = "";
ORACLE_SERVICE_CLOUD.extension_loader.load("Sample")
.then(function(extensionProvider) {
	extensionProvider.registerWorkspaceExtension(function(WorkspaceRecord) {
		WorkspaceRecord.getFieldValues(['Incident.c$fieldX']).then(function(IFieldDetails) {
			field = IFieldDetails.getField('Incident.c$fieldX').getLabel();

                        // Use the value
                        CallSomeFunction(field);
		});
	});
});

 
        

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!