Displaying each user's profile picture from Parse in their respective tableview cells (Swift and Parse) - swift

I am trying to display the profile picture of the author for each post in the tableview using Swift and Parse.
The view controller at hand is querying one class (Post class) from Parse to obtain all the contents of a post. However, only one of the contents of a post (the profile picture which is of type File in Parse) is stored in another class, the User class, because each user has a profile picture.
Each post in the Post class has a foreign key (to represent the author of the post) which points to the User class.
How can I access the photo column from the User class from a pointer in the Post class?

The reference from the post to a user should be a pointer. Then, the query can specify to includeKey with the name of that pointer to have the user included in the results of the query so you can access its details.
The above requires public read permissions on all users. If you want better data security you need to do the above in cloud code and return only the required data.

Related

How to populate fields of an online form

I created a custom record (child of Inventory item) and an online form.
The final goal it's to send a link to a user (not a netsuite user) to display the different informations of this custom record. The user will be able to update some values and submit the form.
I saw it's possible to link a script file to this form, but I need the ID of the record to load it and populate every field of the form.
With normal forms, we have the internalid of the record as an URL param but in this case there is nothing in the URL .
Do you know any way to achieve that ?
A solution for the final goal could be:
Create an empty Suitelet (provides external link for User). Or refer to step 4 for contents.
Stored on the Custom record or via script (created in step 3) you can add to the external link, to include the record type and id as url parameters (&recordtype=customrecord&recid=12345). Be sure to avoid reserved parameter names.
Create a UserEvent, Client, or Scheduled Script to send email to User based on your requirements (in the email include the custom external suitelet link). User will click on the link and land on a NetSuite looking webpage (not requiring credentials).
Modify empty Suitelet. Suitelet should when context.request.method===GET: get parameters, load record(s), get data from record(s), create form, display data to User, display fields for User to enter data, add submit and refresh/cancel button, write/display the form with all fields. Upon submission (when context.request.method is not GET) you can use record.submit method to update the custom record(s).
NetSuite Suite Answer Id 74607 has a Sample Custom Form Suitelet Script from that can be very helpful.

What is the best way to create a form with a confirmation page?

I would like to create the following form:
Step 1: The user enters his contact details.
Step 2: A confirmation page, where the user has the possibility to confirm or edit his entered data again (back to step 1)
The contact details are stored in an entity domain object. The properties have annotations for validation.
My problem:
When I pass the contact object to the confirmation page, I get the message
Could not serialize Domain Object Vendor\Extension\Domain\Model\Object. It is neither an Entity with identity properties set, nor a Value Object.
I understand that I cannot pass a non-persistent domain object. A tip I found was to convert the object to an array and back again later. This works to display the input on the confirmation page. But if the user edits the data, I lose the validation functionality when converting to an array.
Another possibility would be to persist the object already after step 1 (temporarily?) . The problem here is that the data must not be displayed in the backend (they are not yet confirmed). In addition, unused data is created if the user cancels the process.
Is it possible to save objects temporarily?
What is the most elegant solution to this problem?
If you only wan't to create a form, why don't you use a form plugin like Ext:form or Ext:powermail? These have a summary page by default. And you have the possibility to write the entered data into you're database.

Linking Marketo Custom Object to Lead via SOAP

How do I link a custom object created via Marketo's SOAP API to an existing lead?
In your custom object, you can define one of the fields as a 'link'.
In the web interface , when you select 'link', it reloads the dialog and gives you the option to select the linked object type (Lead) and the field to link with (ID).
When you create an object using the SOAP API with a link field like this, you can give the custom object your lead ID to link it.

Facebook Graph API: How to check if an object is a user and not another type of object

Of course you can use http://graph.facebook.com/{object_id} to get a JSON response for that object. However, for my application I want to determine if the object returned is a user and not a page, group, or any other object. Or in other words, I want to query only users.
Is this possible?
I've looked through the Graph API docs, but I can't find a way to ask/query for only users.
This is possible by adding the
metadata=1
parameter in the GET request URL like this:
http://graph.facebook.com/{object_id}&metadata=1
The response will include a type field, which contains the object type of the object you requested

Retrieving the action-instance-id from Facebook given the URL

tl;dr: No, there isn't a way.
Calling publish_action using the JS SDK is actually pretty straightforward. However (from the little info I gleaned from reading the documentation), there's no way for me to query facebook to have it return the action instance ID for an object that I have already published... is there?
Example:
User A loads the page, and the page sends an FB.api call to /me/news.reads, which returns an action instance ID.
User A reloads the page, and the page again sends an FB.api call to /me/news.reads, but this time, the Graph API returns:
{
error: {
code: 3501,
message: 'blahblahblah... already associated... blah blah'
type: 'OAuthException'
}
}
Pretty standard stuff, and expected, since I turned off the ability to publish the same URL multiple times.
Now then, is there any way for me to retrieve a previously published action instance ID from the Graph API by passing in the URL, or is it up to me to handle the returned action instance ID (from the original publication attempt) and save it to a database? I was hoping I wouldn't have to do that...
No, there is no way to retrieve instances of published actions other than:
Accessing action by id:
http://graph.facebook.com/ACTION_ID
Accessing all instances published by specific user:
http://graph.facebook.com/USER_ID/NAMESPACE:ACTION (NAMESPACE:ACTION may be replaces by the name of one of built-in actions like news.reads, music.listend, etc.
If you want to access details of published actions connected/referencing specific object you'll need to save that data on your end for later usage.