Method to find Chrome Bookmarks next available ID number? - google-chrome-extension

Anyone know how to get the next index number available for a Chrome bookmark? The closest I can come right now is pulling the ID of the most recently added and increasing by 1. That works until a user creates a bookmark and immediately deletes it. Then, the id index increases by 1 but most recent returns the most recent bookmark still existing and the number is incorrect.

For bookmarks created in your extension you can use the callback of chrome.bookmarks.create which returns a BookmarkTreeNode (that contains the attribute id).
For bookmarks created by the user outside of your extension (and in your extension) you can listen to chrome.bookmarks.onCreated which will both return a string id and a BookmarkTreeNode.
To get the first id (eg: the first time the extension runs) you could create a bookmark, get the id and then delete it. This might not be needed if you just want to link metadata to bookmarks, the onCreated event should be enough.

Related

Can I subscribe to a "onSave" callback when a Document is saved using the WebPlayer?

Is it possible to subscribe to a callback when an analysis file is saved using the WebPlayer? For example, the user opens a document in the WebPlayer and selects File -> Save As and saves the document. I have checked the JavaScribed API for something like that without any luck.
The reason for the above is that I want to execute logic when the document is saved. For example, on my site, I have a list of analysis files titles that will have to be refreshed when the user saves a document to the location where the list is being generated.
there is no functionality for this in the product. you would probably have to write a custom extension to make this work.
on the other hand you could just refresh the iframe every x seconds, I suppose.

NetSuite : nlapiRemoveLineItem() issue if no value is selected in the list

so we are facing this weird issue. There is a Customer list on the form which is of the type List/Record. On the basis of Customer selected in this list, I clear the transaction list on the child form using nlapiRemoveLineItem() call . Everything works well TILL the customer is selected properly in the customer list.
Now, lets say I just type customer name abc & it gets autopopulated without selecting it as such, in this case, the nlapiRemoveLineItem() on the other list fails miserably and simply adds new items in this list.
What is really happening here ? Can anyone help ?
Javascript runs asynchronously, which means if you call an event like loading the customer, the browser won't wait for the result to come back before it executes the next command, in this case the nlapiRemoveLineItem.
So the sequence of events that is happening goes:
Set the customer
Remove line items
Customer is loaded
Line items from customer are populated
And what you want is:
Set the customer
Customer is loaded
Line items from customer are populated
Remove line items
To achieve this you could either use a promise library like q (best way), make a while loop to wait for the customer to come back, or do it the lazy way and do a setTimeout and execute the line removal around the time you expect the customer to come back.

Lotus Notes embedded view not working for one user

I have an embedded view in a main form (same database) with a single category of a client code that is custom generated. The view displays all other documents that have that main document's client code in a hidden field.
This works perfectly, except for one user where the embedded view is blank, and the message "category not found" is displayed. This happens for all documents viewed. Anyone else that opens the exact same main documents can see the correct list in the embedded view. The documents are definitely there.
I've pressed F9 a few times, and the "category not found" keeps coming up. I've also shutdown Notes and deleted the cache file, and restarted. There have been no changes to the database for a long time, and this started for this one user a few days ago.
I have no idea whats causing this.
Check readers/authors fields in documents that should be displayed in your embedded view. May be that user just can't see them.
Before I get too stressed, I generally try this:
Remove the database from the user's workspace
Compact the workspace (2nd tab of workspace properties)
Close Notes
Delete cache.ndk
Restart Notes
If that doesn't work, I'd check that the user can see the documents in another way (i.e. if you send a doclink to the user, can the user open it (alternatively, try opening the embedded view directly through View - Goto. Don't forget to use CTRL-SHIFT at the same time if the view is hidden)? If not, the user may have lost a role, or dropped out of a group that provides access.
¿The view is "shared" and not "shared, private at first view"? In that case, you have to delete de "private version" of the view for that user
¿The embedded view is calculated, and show one view for a group of users and a second view for another group? Maybe you're searching the problem in the wrong view
¿The single category is based on a formula or on a calculated field? In that case, the formula calculates a different value for that user

chrome extension what's the use of argument: tabld?

I'm learning how to write a chrome extension.
in most of the apis, there is a argument: tabld.
I can't understand what is it used for.
for example ,function chrome.browserAction.setIcon's description is here
I searched all over the internet and chrome extension documents, there is not even a example there, just a sample describe said:
tabId ( optional integer ) Limits the change to when a particular tab
is selected. Automatically resets when the tab is closed.
what this argument used for? can anyone give me a example of it ?
Best regards
Each tab in Chrome has unique ID which resets after browser restart. It is useful when you want to identify tabs.
In 99% cases you will be interested only in currently selected tab because it is where a user is right now. You can just pass null instead of tabId to almost any method and it would mean you want selected tab id. Same with window id - passing null usually means current window.
Otherwise you can get selected tab with chrome.tabs.getSelected, which returns tab object containing id. You can get all tabs with their ids with chrome.tabs.getAllInWindow.

Handling the back browser button while iterating through a list

I have a list that I iterate through and fill in the fields one page at a a time. I'm using an array list and I increment a counter everytime the user clicks the next button.
This works well. The problem comes when a user wants to go back and edit the previous entries. The counter stays the same and the current user in the backing bean gets updated with the users input. The user at [counter] in the array list then gets updated and instead of the one that was navigated to.
Any ideas how I can implement this? If I could intercept the submit button and update the current user with the user in focus then I could update the current id manually and save to that slot. Any other ideas? I hope this makes sense.
Thanks
Wayne
It's not much of an answer but it will have to do for now. I've referenced the id from the array list directly and created 10 different pages which only load if the array list is large enough. It works for me because 10 is a maximum. If any of you have a better solution I'd love to hear it.

Resources