I am trying to set the value of identity in SailPoint whilst creating the identity as part of the aggregation. Can anyone help what the identity rule should look like?
setAttribute didn't work.
your question is not clear, maybe you need to understand a little bit how IIQ is supposed to work.
First thing is to create an authoritative application, which will provide data for the identity creation at IIQ. In IIQ terms, this means that you will create an application with the "authoritative application" checkbox marked. While aggregating for this application, accounts will automatically generate IIQ Identities, that must be uniquely identified somehow (maybe some universal identity identifier you have).
Then, you'll start to add other non-authoritative applications, and each one of them must have some correlation criteria defined to bind these applications accounts to the identities created by your authoritative application account aggregation process. If for some reason the correlation criteria can't find the identity, then IIQ will (by default, but you can set this off in the aggregation task) created "orphan identities" which are identities that are not correlated and that must be manually correlated.
So the answer for your question, I think, is that IIQ by default will create identities for the accounts you're aggregating into IIQ, so there's no need for a rule to create identities from an account aggregation process. However, there are several types of rules in IIQ and they're documented in this very useful document - https://community.sailpoint.com/t5/Technical-White-Papers/Rules-in-IdentityIQ-7-0-7-2/ta-p/78176 (you must be authenticated to download)