Invalid command - Custom floating window

Hello

I am working on floating window, but some commands are not working, I am getting ‘Invalid command’ error.
Like, SHOW_FLOATING_WINDOW and SET_FOCUS_MODE

My code

<html>
	<head>
		<title>Custom UI: Basic HTML example</title>
	</head>
	<body>
		<h1>Hello from Custom UI</h1>
	</body>
	<footer>
		<script src="https://cdn.jsdelivr.net/npm/@pipedrive/app-extensions-sdk@0.2.0-rc.0/dist/index.umd.js"></script>
		<script>
			setTimeout(async function() {
				console.log('timeout inside');
				const sdk = await new AppExtensionsSdk().initialize();

				await sdk.execute(AppExtensionsSdk.Command.RESIZE, { height: 500 });

				const { confirmed } = await sdk.execute(AppExtensionsSdk.Command.SHOW_CONFIRMATION, {
					title: 'Confirm',
					description: 'Are you sure you want to complete this action?',
				});

				/*
				//Getting Invalid command error for below commands
				
				await sdk.execute(AppExtensionsSdk.Command.SHOW_FLOATING_WINDOW, {
					context: {
						person_id: 42,
					}
				});

				await sdk.execute(AppExtensionsSdk.Command.SET_FOCUS_MODE, true);

				*/

			}, 5000);

		</script>
	</footer>
</html>

Thank you

Hi @Kumar_B,

The SDK version that you are loading is outdated. We have just updated our SDK so the latest version should now work via CDN.

The instructions are in our readme here.

Also, you should have access to floating window commands now.

Can you try this, please?

1 Like

Hello, @Nicole_Tan

Yes, new version is working, but still there are flaws.

I was testing ‘REDIRECT_TO’ command, but It didn’t work.

<html>
	<head>
		<title>Custom UI: Basic HTML example</title>
		<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/@pipedrive/app-extensions-sdk@0/dist/index.umd.js"></script>
		<script>
			setTimeout(async function() {
				console.log('timeout inside 008');
				const sdk = await new AppExtensionsSDK().initialize();

				await sdk.execute(AppExtensionsSDK.Command.SHOW_FLOATING_WINDOW);
				await sdk.execute(AppExtensionsSDK.Command.REDIRECT_TO, { view: View.CONTACTS, id: 2694 });

			}, 5000);

		</script>

	</head>
	<body>
		<h1>Hello from Custom UI 008</h1>
	</body>

</html>

Error,

Hi @Kumar_B,

At the moment, we don’t export View along other types (Command, Event, etc) > app-extensions-sdk/umd.ts at master · pipedrive/app-extensions-sdk · GitHub.

Can you check here and use strings, please?

From your code, it should be:
await sdk. execute ( AppExtensionsSDK .Command.REDIRECT_TO, { view: "contacts", id: 2694 });

This topic was automatically closed after 10 days. New replies are no longer allowed.